SuperNN  1.0.0
Public Member Functions | Protected Member Functions | List of all members
SuperNN::TrainingAlgorithm Struct Referenceabstract

Abstract class that provides the calculation of the error derivatives and the error accumulation, used by the derived backpropagation training algorithms. More...

Inheritance diagram for SuperNN::TrainingAlgorithm:
Inheritance graph
[legend]

Public Member Functions

virtual ~TrainingAlgorithm ()
 
virtual void clear_derror_acc (Network &net)
 Clears the accumulated error partial derivatives. More...
 
virtual double delta (Network &net, unsigned l, unsigned n)
 Calculates the local error gradient for each neuron. More...
 
virtual void derror_acc (Network &net)
 Accumulates the error partial derivative in respect to the weights, for each connection of the neural network. More...
 
virtual void prepare (Network &net)
 Prepares the trainer and a neural network for training. More...
 
virtual unsigned train (Network &net, const Data &data, double dmse=0, unsigned max_epochs=1000)=0
 Adjusts the synaptic weight of an artificial neural network in order to minimize the error (MSE for standard l2 training or MAE for specific l1 training). More...
 

Protected Member Functions

virtual void check (const Network &net, const Data &data) const
 Checks if the dimensions match and if the training algorithm can be used with a given network and data. More...
 

Detailed Description

Abstract class that provides the calculation of the error derivatives and the error accumulation, used by the derived backpropagation training algorithms.

Definition at line 34 of file training.hpp.

Constructor & Destructor Documentation

SuperNN::TrainingAlgorithm::~TrainingAlgorithm ( )
virtual

Definition at line 62 of file training.cpp.

Member Function Documentation

void SuperNN::TrainingAlgorithm::check ( const Network net,
const Data data 
) const
protectedvirtual

Checks if the dimensions match and if the training algorithm can be used with a given network and data.

Parameters
netNeural network to be trained
dataTraining data
Exceptions
Exceptionif the algorithm can not be used with the network or data

Definition at line 71 of file training.cpp.

void SuperNN::TrainingAlgorithm::clear_derror_acc ( Network net)
virtual

Clears the accumulated error partial derivatives.

Parameters
netNeural network

Definition at line 101 of file training.cpp.

double SuperNN::TrainingAlgorithm::delta ( Network net,
unsigned  l,
unsigned  n 
)
virtual

Calculates the local error gradient for each neuron.

It's a recursive operation, where calculating the delta for a neuron will automatically calculate the delta for the neurons in the next layers that have connections with this neuron.

For an output neuron j: $\delta_{j} = err * g'(net_j)$

For a hidden neuron j: $\delta_{j} = \displaystyle\sum_{k} delta_{k} * w_{jk} * g'(net_j) $

Parameters
netNeural network to be used
lLayer where the neuron is located
nNeuron position in the layer
Returns
Calculated delta

Reimplemented in SuperNN::IRpropL1.

Definition at line 33 of file training.cpp.

void SuperNN::TrainingAlgorithm::derror_acc ( Network net)
virtual

Accumulates the error partial derivative in respect to the weights, for each connection of the neural network.

$\frac{\partial E}{\partial w_{ij}} = -\delta_j * y_i$

Parameters
netNeural network

Definition at line 82 of file training.cpp.

void SuperNN::TrainingAlgorithm::prepare ( Network net)
virtual

Prepares the trainer and a neural network for training.

Usually this will initialize the learning rates, previous error informations and prepare the internal data structures for the training. Between a prepare() and a train(), the neural network and the trainer shouldn't be modified.

Parameters
netNeural network to be prepared

Reimplemented in SuperNN::NBN, and SuperNN::IRprop.

Definition at line 67 of file training.cpp.

virtual unsigned SuperNN::TrainingAlgorithm::train ( Network net,
const Data data,
double  dmse = 0,
unsigned  max_epochs = 1000 
)
pure virtual

Adjusts the synaptic weight of an artificial neural network in order to minimize the error (MSE for standard l2 training or MAE for specific l1 training).

Parameters
netArtificial neural network to be trained
dataTraining data
dmseDesired mean squared error (or MAE when applied). Stopping condition
max_epochsMaximum number of epochs to train the network. Stopping condition
Returns
The number of training epochs performed

Implemented in SuperNN::NBN, SuperNN::IRprop, SuperNN::Batch, SuperNN::Incremental, and SuperNN::ImplBackprop.