|
Deep Neuronal Filter
|
This is the class for creating layers that are contained inside the Net class. More...
#include <Layer.h>
Public Types | |
| enum | whichGradient { exploding = 0, average = 1, vanishing = 2 } |
| Options for what gradient of a chosen error to monitor. | |
Public Member Functions | |
| Layer (int _nNeurons, int _nInputs, int _subject, string _trial) | |
| Constructor for Layer: it initialises the neurons internally. More... | |
| ~Layer () | |
| Destructor De-allocated any memory. | |
| void | initLayer (int _layerIndex, Neuron::weightInitMethod _wim, Neuron::biasInitMethod _bim, Neuron::actMethod _am) |
| Initialises each layer with specific methods for weight/bias initialisation and activation function of neurons. More... | |
| void | setlearningRate (double _w_learningRate, double _b_learningRate) |
| Sets the learning rate. More... | |
| void | setInputs (const double *_inputs, const double scale=1.0, const unsigned int offset=0, const int n=-1) |
| Sets the inputs to all neurons in the first hidden layer only. More... | |
| void | propInputs (int _index, double _value) |
| Sets the inputs to all neurons in the deeper layers (excluding the first hidden layer) More... | |
| void | calcOutputs () |
| Demands that all neurons in this layer calculate their output. | |
| void | setError (double _error) |
| Sets the error to be propagated backward at all neurons in the output layer only. More... | |
| double | getGradient (whichGradient _whichGradient) |
| Allows for accessing the error that propagates backward in the network. More... | |
| void | updateWeights () |
| Requests that all neurons perform one iteration of learning. | |
| Neuron * | getNeuron (int _neuronIndex) |
| Allows access to a specific neuron. More... | |
| int | getnNeurons () |
| Reports the number of neurons in this layer. More... | |
| double | getOutput (int _neuronIndex) |
| Allows for accessing the activation of a specific neuron. More... | |
| double | getSumOutput (int _neuronIndex) |
| Allows for accessing the sum output of any specific neuron. More... | |
| double | getWeights (int _neuronIndex, int _weightIndex) |
| Allows for accessing any specific weights in the layer. More... | |
| double | getWeightChange () |
| Accesses the total sum of weight changes of all the neurons in this layer. More... | |
| double | getWeightDistance () |
| Performs squared root on the weight change. More... | |
| double | getGlobalError (int _neuronIndex) |
| Reports the global error that is assigned to a specific neuron in this layer. More... | |
| double | getInitWeight (int _neuronIndex, int _weightIndex) |
| Reports the initial value that was assigned to a specific weight at the initialisatin of the network. More... | |
| void | saveWeights () |
| Saves the temporal weight change of all weights in all neurons into files. | |
| void | snapWeights (string prefix, string _trial, int _subject) |
| Snaps the final distribution of weights in a specific layer, this is overwritten every time the function is called. | |
| void | snapWeightsMatrixFormat (string prefix) |
| void | printLayer () |
| Prints on the console a full tree of this layer with the values of all weights and outputs for all neurons. | |
This is the class for creating layers that are contained inside the Net class.
The Layer instances in turn contain neurons.
| Layer::Layer | ( | int | _nNeurons, |
| int | _nInputs, | ||
| int | _subject, | ||
| string | _trial | ||
| ) |
Constructor for Layer: it initialises the neurons internally.
| _nNeurons | Total number of neurons in the layer |
| _nInputs | Total number of inputs to that layer |
| double Layer::getGlobalError | ( | int | _neuronIndex | ) |
Reports the global error that is assigned to a specific neuron in this layer.
| _neuronIndex | the neuron index |
| double Layer::getGradient | ( | whichGradient | _whichGradient | ) |
Allows for accessing the error that propagates backward in the network.
| _neuronIndex | The index from which the error is requested |
| double Layer::getInitWeight | ( | int | _neuronIndex, |
| int | _weightIndex | ||
| ) |
Reports the initial value that was assigned to a specific weight at the initialisatin of the network.
| _neuronIndex | Index of the neuron containing the weight |
| _weightIndex | Index of the weight |
| Neuron* Layer::getNeuron | ( | int | _neuronIndex | ) |
Allows access to a specific neuron.
| _neuronIndex | The index of the neuron to access |
| int Layer::getnNeurons | ( | ) |
Reports the number of neurons in this layer.
| double Layer::getOutput | ( | int | _neuronIndex | ) |
Allows for accessing the activation of a specific neuron.
| _neuronIndex | The index of the neuron |
| double Layer::getSumOutput | ( | int | _neuronIndex | ) |
Allows for accessing the sum output of any specific neuron.
| _neuronIndex | The index of the neuron to access |
| double Layer::getWeightChange | ( | ) |
Accesses the total sum of weight changes of all the neurons in this layer.
| double Layer::getWeightDistance | ( | ) |
Performs squared root on the weight change.
| double Layer::getWeights | ( | int | _neuronIndex, |
| int | _weightIndex | ||
| ) |
Allows for accessing any specific weights in the layer.
| _neuronIndex | The index of the neuron containing that weight |
| _weightIndex | The index of the input to which that weight is assigned |
| void Layer::initLayer | ( | int | _layerIndex, |
| Neuron::weightInitMethod | _wim, | ||
| Neuron::biasInitMethod | _bim, | ||
| Neuron::actMethod | _am | ||
| ) |
Initialises each layer with specific methods for weight/bias initialisation and activation function of neurons.
| _layerIndex | The index that is assigned to this layer by the Net class |
| _wim | weights initialisation method, see Neuron::weightInitMethod for different options |
| _bim | biases initialisation method, see Neuron::biasInitMethod for different options |
| _am | activation method, see Neuron::actMethod for different options |
| void Layer::propInputs | ( | int | _index, |
| double | _value | ||
| ) |
Sets the inputs to all neurons in the deeper layers (excluding the first hidden layer)
| _index | The index of the input |
| _value | The value of the input |
| void Layer::setError | ( | double | _error | ) |
Sets the error to be propagated backward at all neurons in the output layer only.
| _leadError | the error to be propagated backward |
| void Layer::setInputs | ( | const double * | _inputs, |
| const double | scale = 1.0, |
||
| const unsigned int | offset = 0, |
||
| const int | n = -1 |
||
| ) |
Sets the inputs to all neurons in the first hidden layer only.
| _inputs | A pointer to an array of inputs |
| void Layer::setlearningRate | ( | double | _w_learningRate, |
| double | _b_learningRate | ||
| ) |
Sets the learning rate.
| _learningRate | Sets the learning rate for all neurons. |