|
Public Member Functions |
| | MultiLayerNetwork (uint inputs, uint neuronLabelOffset=0, PublicValues &pv=defaultControl) |
| | Create a multi-layer network.
|
| | MultiLayerNetwork (uint inputs, PublicValues &pv) |
| | MultiLayerNetwork (MultiLayerNetwork &srcNet) |
| | Copy constructor, NOT YET IMPLEMENTED.
|
| | MultiLayerNetwork (const std::string &filename) |
| | Loads a multi-layer network from the given filename.
|
| virtual | ~MultiLayerNetwork () |
| virtual void | addLayer (int size) |
| | Adds a layer of the given size to the network. This new layer becomes the output layer.
|
| virtual void | connectLayer (uint srcLlayer) |
| | Completely connects the given layer with the layer below it, i.e., all neurons in the given layer will give their output to all the neurons in the layer below.
|
| virtual void | connect (uint srcLlayer, int srcNrn, int destNrn) |
| | Connects two neurons, with random weight.
|
| virtual void | connect (uint srcLlayer, int srcNrn, int destNrn, real weight) |
| | Connects two neurons, with the weight provided.
|
| virtual void | setBias (uint layer, int nrn, real bias) |
| | Sets the bias of the given neuron.
|
| virtual uint | getLayerCount () const |
| | The number of layers in the network (does not count the input layer as a layer).
|
| virtual Vector | getOutput (const Vector &input) |
| | Returns the output of the network for the given input.
|
| virtual Vector | getOutput (real *input) |
| | Wrapper function to allow getOutput() to work for an array of real as input as well.
|
| virtual void | train (TrainingSet &T, uint epochs, real learningRate=DEFAULT_LEARNINGRATE, real momentum=DEFAULT_MOMENTUM) |
| | Trains the network with data from the given TrainingSet using the backpropagation algorithm.
|
| virtual void | train (TrainingSet &T, Creal epochs, Creal learningRate=CDEFAULT_LEARNINGRATE, Creal momentum=CDEFAULT_MOMENTUM) |
| virtual void | train (TrainingSet &T, PublicValues ¶meters) |
| | get epochs, learningRate and momentum from the supplied PublicValues
|
| void | getError (TrainingSet &ts) |
| | compute error for the given traning set. The "epoch error" and "normalized epoch error" are then stored in the _control
|
| void | getErrorGREN (TrainingSet &ts) |
| | compute error for the given traning set. The "epoch error" and "normalized epoch error" are then stored in the _control
|
| Error | getErrorGREN (const Vector &input, const Vector &desired) |
| | real error for one example
|
| virtual void | trainExample (const Vector &input, const Vector &desiredOutput, real learningRate=DEFAULT_LEARNINGRATE, real momentum=DEFAULT_MOMENTUM) |
| | Trains one example only.
|
| virtual void | save (const std::string &filename) |
| | Saves the network to the given filename.
|
| virtual void | setActivationFunction (uint layer, ActivationFunction f, ActivationFunction df) |
| | Sets the activation function used by the neurons in the provided layer.
|
| virtual const char * | getClassName () const |
| | Returns "MultiLayerNetwork".
|
| void | resetWeights () |
| | initialize weights to small values
|
| const Layer & | getLayer (uint layer) const |
| | Get a layer of the network (0=input) - Exceptions:
-
| Exception | if an invalid layer is given. |
|
| uint | getNeuronsCount () const |
| | Get the total count of neurons in all layers (excluding input "layer").
|
| uint | getLinksCount () const |
| | Get count of all weights of all neurons.
|
| Layer & | getLayer (uint layer) |
| | Warning: using this non-const version, you can change the network's behaviour.
|
| | operator std::string () const |
| | get brief info about the topology, etc.
|
| PublicValues & | getControl () |
| void | setControl (PublicValues &ctrl) |
| void | setLabelOffset (uint firstLabel) |
| virtual void | trainGREN (MultiLayerNetwork &errorNetwork, TrainingSet &ts, uint epochs, real learningRate=DEFAULT_LEARNINGRATE, real momentum=DEFAULT_MOMENTUM) |
| | Train the network using the error network.
|
Static Public Attributes |
| const real | DEFAULT_MOMENTUM |
| const real | DEFAULT_LEARNINGRATE |
| const Creal | CDEFAULT_MOMENTUM |
| const Creal | CDEFAULT_LEARNINGRATE |
Protected Member Functions |
| InputLayer * | _inputLayer () |
| | The input layer.
|
| Layer * | _outputLayer () |
| | The output layer.
|
| void | _layerValid (uint layer) const |
| | impl detail - throws then layer is not valid
|
| void | _connectLayer (Layer &srcLayer, Layer &destLayer) |
| void | _attachGREN (MultiLayerNetwork &errorNetwork, bool detach) |
| | attach or detach the gren. TODO: detach doesn't yet restore the input links of GREN, so it's unusable after training standalone
|
| void | _trainExampleGREN (MultiLayerNetwork &errorNetwork, const Vector &input, real learningRate, real momentum) |
| | unlike _trainExample, _trainExampleGREN assumes that input was already presented
|
Protected Attributes |
| uint | _nLayers |
| | Number of layers in the network.
|
| std::vector< Layer * > | _layers |
| | The layers.
|
| PublicValues * | _control |
| Error | _exampleError |
| uint | _neuronLabelOffset |
Basically, layers of SimpleNeurons constitute this network. Training is done using the backpropagation technique which uses the gradient descent method.
The labels of the layers start from 0 (for the input layer) and then keep moving on. The labels of neurons in the layers is = *Layer::MAX_LAYER_SIZE +
All neurons in the layers are allowed to have a bias.