class Weight: public Link

This class implements the weights of a neural network, i.e. a weighted link. It propagates changes to connected neurons, so that they can recalculate their outputs when necessary (and only then). Moreover, each weight can calculate its gradient component, provided that the output neurons have had their 'delta' set.

Attributes:

None public

Methods:

Weight()
Default constructor, initialize the weight with a random value between -0.1 and 0.1
Weight(double x)
Constructor, initialize the weight to the given value.
double value()
Returns the output of the weight, that is, the value of the from() neuron times the weight value.
double gradient()
Returns the gradient element relative to this weight. See the NeuralNet class for use.
double set(double x)
Sets the value of the weight to the given value.
virtual ostream &writeTo(ostream &o)
Stream helper: writes the weight value to the stream.
istream &readFrom(istream &i)
Stream helper: sets the weight value to the number read from the stream.
static istream& dummyRead(istream &i)
Stream helper: reads a number from the stream and discards it.