class Neuron: public Node

This class implements the neuron of a neural network: its output is given by applying the activation function to the sum of the outputs of the incoming weights. Each neuron implements part of the BP algorithm so that connected weights can calculate their gradient components. It also propagates changes forward (changes to value) and backward (changes realtive to BP).

Attributes:

None public.

Typedefs:

typedef double (*nf)(double);
nf is the type of activation functions and their derivatives.

Methods:

Neuron(nf a, nf da)
Constructor: sets the activation function and its derivative; sets both 'changed' states to true.
Neuron()
Default constructor: do not use!. Default contructed neurons have no defined activation function, and as such are non working. This constructor is only used for streaming.
virtual Neuron* clone()
Returns a new neuron with the same functions as this one. Used in recurrent neural networks
virtual double value()
Returns the output value of this neuron, calculated only as necessary.
virtual double delta()
Returns the 'delta' value relative to this neuron, as defined by the BackPropagation algorithm: if N is the 'error function', ans sum is the sum of the inputs to this neuron, this delta is dN/d(sum). See the NeuralNet class for use.
virtual double delta(double derr)
Sets the 'delta' of this neuron. Note: this is not the same delta as above. This one is dN/d(out), out being the output of the neuron. It is this way because to obtain the above delta one needs to know the derivative of the neuron's activation function, which is a private attribute.
bool is_back_changed()
Returns true if some change has happened that invalidates the BP-calculated values depending on this neuron.
virtual void set_back_changed(bool s=true)
Sets the 'back changed' state to the given value, and if it is true propagates it backward thru the network.
virtual void set_changed(bool s=true)
Sets the 'changed' state to the given value, and if it is true propagates it forward thru the network.
virtual ostream &writeTo(ostream &o)
Stream helper: writes the names of the neuron's function to the stream (see the function streaming system)
istream &readFrom(istream &i)
Stream helper: sets the neuron's functions to those whose names are read from the stream.
static istream& dummyRead(istream &i)
Stream helper: reads two names from the stream, and discards them.