A classic SGDTrainer. More...
#include <Backpropagation.h>
Inherits net::SGDTrainer.
Public Member Functions | |
Backpropagation (double learningRate_, double momentumTerm_, double targetErrorLevel_, int maximumEpochs_) | |
Initialize the Backpropagation object with necessary constants. More... | |
Backpropagation () | |
Initialize empty Backpropagation object. More... | |
Backpropagation (std::ifstream *input) | |
Loads a Backpropagation object using an input stream. More... | |
void | store (std::ofstream *output) |
Stores a Backpropagation object using specified ofstream. More... | |
bool | initFromStream (std::ifstream *in) |
Public Member Functions inherited from net::SGDTrainer | |
SGDTrainer () | |
Initialize empty Backpropagation object. More... | |
SGDTrainer (double targetErrorLevel_, int maximumEpochs_) | |
Initialize the object with necessary constants. More... | |
double | train (net::NeuralNet *network, const std::vector< std::vector< double > > &input, const std::vector< std::vector< double > > &correctOutput) |
Trains a neural network on a training set until the target error level is reached. More... | |
double | trainEpocs (double numberOfEpochs, net::NeuralNet *network, const std::vector< std::vector< double > > &input, const std::vector< std::vector< double > > &correctOutput) |
Trains a neural network on a training set for a specified number of epochs. More... | |
void | store (std::ofstream *out) |
Stores a Trainer object using specified stream. More... | |
bool | initFromStream (std::ifstream *in) |
Public Member Functions inherited from net::Trainer | |
std::vector< std::vector < std::vector< std::vector < double > > > > | getGradients () |
std::vector< std::vector < std::vector< std::vector < double > > > > | getWeightChanges () |
std::vector< std::vector < std::vector< double > > > | getInitialWeights () |
std::vector< std::vector < std::vector< double > > > | getFinalWeights () |
Public Attributes | |
double | learningRate |
The rate of learning, set by constructor. More... | |
double | momentumTerm |
The term of momentum, set by constructor. More... | |
Public Attributes inherited from net::SGDTrainer | |
double | targetErrorLevel |
The target error level, set by constructor. More... | |
int | maximumEpochs |
The maximum number of iterations, set by constructor. More... | |
Protected Member Functions | |
double | getChangeInWeight (double weight, int layerIndex, int neuronIndex, int weightIndex) |
Protected Member Functions inherited from net::SGDTrainer | |
double | trainOnDataPoint (net::NeuralNet *network, const std::vector< double > &input, const std::vector< double > &correctOutput) |
Gets the output of the neural network, calculates the error of each neuron, and edits the weights of the neurons to reduce error. More... | |
virtual void | resetNetworkVectors (net::NeuralNet *network) |
Resets the Backpropagation object's neural network specific vectors using a neural network (NN is needed because the number of layers, neurons, and weights are needed). More... | |
Additional Inherited Members | |
Protected Attributes inherited from net::Trainer | |
std::vector< std::vector < std::vector< std::vector < double > > > > | gradients |
std::vector< std::vector < std::vector< std::vector < double > > > > | weightChanges |
std::vector< std::vector < std::vector< double > > > | initialWeights |
std::vector< std::vector < std::vector< double > > > | finalWeights |
A classic SGDTrainer.
Backpropagation::Backpropagation | ( | double | learningRate_, |
double | momentumTerm_, | ||
double | targetErrorLevel_, | ||
int | maximumEpochs_ | ||
) |
Initialize the Backpropagation object with necessary constants.
learningRate_ | controls how much the neural network is modified each learning iteration |
momentumTerm_ | allows a network to escape a local max |
targetErrorLevel_ | at this error level, a net will be considered trained |
maximumEpochs_ | after this number of training iterations (one pass through all of the data points), a net will stop being trained no matter what |
Backpropagation::Backpropagation | ( | ) |
Initialize empty Backpropagation object.
|
explicit |
Loads a Backpropagation object using an input stream.
input | a pointer to the input stream that contains a stored Backpropagation model |
|
protectedvirtual |
Implements net::SGDTrainer.
bool Backpropagation::initFromStream | ( | std::ifstream * | in | ) |
|
virtual |
Stores a Backpropagation object using specified ofstream.
output | pointer to the output stream which the neural network will be written to |
Implements net::Trainer.
double net::Backpropagation::learningRate |
The rate of learning, set by constructor.
double net::Backpropagation::momentumTerm |
The term of momentum, set by constructor.