|
Deep Neuronal Filter
|
Net is the main class used to set up a neural network used for closed-loop Deep Learning. More...
#include <Net.h>
Public Member Functions | |
| Net (const int _nLayers, const int *const _nNeurons, const int _nInputs, const int _subject, const string _trial) | |
| Constructor: The neural network that performs the learning. More... | |
| ~Net () | |
| Destructor De-allocated any memory. | |
| void | initNetwork (Neuron::weightInitMethod _wim, Neuron::biasInitMethod _bim, Neuron::actMethod _am) |
| Dictates the initialisation of the weights and biases and determines the activation function of the 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 the network in each iteration of learning, needs to be placed in an infinite loop. More... | |
| void | propInputs () |
| It propagates the inputs forward through the network. | |
| void | propErrorBackward () |
| Propagates the error backward. | |
| void | setError (double _leadError) |
| Sets the error at the output layer to be propagated backward. More... | |
| double | getGradient (Layer::whichGradient _whichGradient) |
| It provides a measure of how the magnitude of the error changes through the layers to alarm for vanishing or exploding gradients. More... | |
| void | updateWeights () |
| Requests that all layers perform one iteration of learning. | |
| Layer * | getLayer (int _layerIndex) |
| Allows Net to access each layer. More... | |
| double | getOutput (int _neuronIndex) |
| Allows the user to access the activation output of a specific neuron in the output layer only. More... | |
| double | getSumOutput (int _neuronIndex) |
| Allows the user to access the weighted sum output of a specific neuron in output layer only. More... | |
| int | getnLayers () |
| Informs on the total number of hidden layers (excluding the input layer) More... | |
| int | getnInputs () |
| Informs on the total number of inputs to the network. More... | |
| double | getWeightDistance () |
| Allows for monitoring the overall weight change of the network. More... | |
| double | getLayerWeightDistance (int _layerIndex) |
| Allows for monitoring the weight change in a specific layer of the network. More... | |
| double | getWeights (int _layerIndex, int _neuronIndex, int _weightIndex) |
| Grants access to a specific weight in the network. More... | |
| int | getnNeurons () |
| Informs on the total number of neurons in the network. More... | |
| void | saveWeights () |
| Saves the temporal changes of all weights in all neurons into files. | |
| void | snapWeights (string prefix, string _trial, int _subject) |
| Snaps the final distribution of all weights in a specific layer, this is overwritten every time the function is called. | |
| void | snapWeightsMatrixFormat (string prefix) |
| void | printNetwork () |
| Prints on the console a full tree of the network with the values of all weights and outputs for all neurons. | |
Net is the main class used to set up a neural network used for closed-loop Deep Learning.
It initialises all the layers and the neurons internally.
(C) 2019,2020, Bernd Porr bernd@glasgowneuro.tech (C) 2019,2020, Sama Daryanavard 2089166d@student.gla.ac.uk
GNU GENERAL PUBLIC LICENSE
| Net::Net | ( | const int | _nLayers, |
| const int *const | _nNeurons, | ||
| const int | _nInputs, | ||
| const int | _subject, | ||
| const string | _trial | ||
| ) |
Constructor: The neural network that performs the learning.
| _nLayers | Total number of hidden layers, excluding the input layer |
| _nNeurons | A pointer to an int array with number of neurons for all layers need to have the length of _nLayers. |
| _nInputs | Number of Inputs to the network |
| double Net::getGradient | ( | Layer::whichGradient | _whichGradient | ) |
It provides a measure of how the magnitude of the error changes through the layers to alarm for vanishing or exploding gradients.
| _whichError | choose what error to monitor, for more information see Neuron::whichError |
| _whichGradient | choose what gradient of the chosen error to monitor, for more information see Layer::whichGradient |
| Layer* Net::getLayer | ( | int | _layerIndex | ) |
| double Net::getLayerWeightDistance | ( | int | _layerIndex | ) |
Allows for monitoring the weight change in a specific layer of the network.
| _layerIndex | The index of the chosen layer |
| int Net::getnInputs | ( | ) |
Informs on the total number of inputs to the network.
| int Net::getnLayers | ( | ) |
Informs on the total number of hidden layers (excluding the input layer)
| int Net::getnNeurons | ( | ) |
Informs on the total number of neurons in the network.
| double Net::getOutput | ( | int | _neuronIndex | ) |
Allows the user to access the activation output of a specific neuron in the output layer only.
| _neuronIndex | The index of the chosen neuron |
| double Net::getSumOutput | ( | int | _neuronIndex | ) |
Allows the user to access the weighted sum output of a specific neuron in output layer only.
| _neuronIndex | The index of the chosen neuron |
| double Net::getWeightDistance | ( | ) |
Allows for monitoring the overall weight change of the network.
| double Net::getWeights | ( | int | _layerIndex, |
| int | _neuronIndex, | ||
| int | _weightIndex | ||
| ) |
Grants access to a specific weight in the network.
| _layerIndex | Index of the layer that contains the chosen weight |
| _neuronIndex | Index of the neuron in the chosen layer that contains the chosen weight |
| _weightIndex | Index of the input to which the chosen weight is assigned |
| void Net::initNetwork | ( | Neuron::weightInitMethod | _wim, |
| Neuron::biasInitMethod | _bim, | ||
| Neuron::actMethod | _am | ||
| ) |
Dictates the initialisation of the weights and biases and determines the activation function of the neurons.
| _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 Net::setError | ( | double | _leadError | ) |
Sets the error at the output layer to be propagated backward.
| _leadError | The closed-loop error for learning |
| void Net::setInputs | ( | const double * | _inputs, |
| const double | scale = 1.0, |
||
| const unsigned int | offset = 0, |
||
| const int | n = -1 |
||
| ) |
Sets the inputs to the network in each iteration of learning, needs to be placed in an infinite loop.
| _inputs | A pointer to the array of inputs |
| void Net::setLearningRate | ( | double | _w_learningRate, |
| double | _b_learningRate | ||
| ) |
Sets the learning rate.
| _learningRate | Sets the learning rate for all layers and neurons. |