BackPropagationAlgo Class Reference

Back-Propagation Algorithm implementation.

Inheritance diagram for BackPropagationAlgo:

Inheritance graph
[legend]
Collaboration diagram for BackPropagationAlgo:

Collaboration graph
[legend]
List of all members.

Constructors

 BackPropagationAlgo (BaseNeuralNet *n_n, UpdatableVec update_order, Real l_r=0.1f)

Interface

void setTeachingInput (Cluster *output, const RealVec &ti)
virtual void learn ()
virtual void learn (const Pattern &)
virtual Real calculateMSE (const Pattern &)
void setRate (Real newrate)
Real rate ()
void setMomentum (Real newmom)
Real momentum ()
void enableMomentum ()
void disableMomentum ()
const RealVecgetError (Cluster *)

Constructor & Destructor Documentation

BackPropagationAlgo ( BaseNeuralNet n_n,
UpdatableVec  update_order,
Real  l_r = 0.1f 
)

Constructor

Parameters:
neural_network the BaseNeuralNet neural network to train
update_order the UpdatableVec for the backpropagation sequence
learn_rate the Real learning rate factor

~BackPropagationAlgo (  ) 

Destructor.


Member Function Documentation

void setTeachingInput ( Cluster output,
const RealVec ti 
)

Set the teaching input for Cluster passed

Parameters:
teach_input the RealVec teaching input

virtual void learn (  )  [virtual]

a single step of learning algorithm

Implements LearningAlgorithm.

virtual void learn ( const Pattern  )  [virtual]

Starts a single training step.

Implements LearningAlgorithm.

virtual Real calculateMSE ( const Pattern  )  [virtual]

Calculate the Mean Square Error respect to Pattern passed

Implements LearningAlgorithm.

void setRate ( Real  newrate  )  [inline]

Set the learning rate

Real rate (  )  [inline]

return the learning rate

void setMomentum ( Real  newmom  )  [inline]

Set the momentum value

Real momentum (  )  [inline]

return the momentum

void enableMomentum (  ) 

Enable the momentum

void disableMomentum (  )  [inline]

Disable momentum

const RealVec& getError ( Cluster  ) 

This method returns the deltas calculated by the Back-propagation Algorithm. These deltas are set every time new targets are defined for the output layer(s), which are then used to update network weights when the method learn() is called.
They are also useful to calculate the network performance, but for that it must be used outside the learning cycle (a full learning iteration, that corresponds to present the network with all the patterns of the train data set). For that you must call getError( Cluster * anyOutputCluster ) for each line of your training set (you'll get a RealVec with the deltas for each unit of the cluster considered).
Then you can use those values to calculate your desired performance measure.
For instance: if you use it to calculate the Mean Square Error (MSE) of the network for your train data set you must accumulate the square of the the getError( anyOutputCluster ) output for each line of the set, and at the end divide it by the length of that same set (by definition the MSE is the sum of the squared differences between the target and actual output of a sequence of values). Getting the Root Mean Squared Error (RMSE) from this is trivial (you just need to calculate the square root of the MSE).

Warning:
The data returned by getError( Cluster * ) is computed every time you set a new output target, which means every time you call the setTeachingInput( Cluster * anyOutputCluster, const RealVec & teaching_input ) method. If your network has more than one output layer you have to call setTeachingInput() for all the output clusters before calling getError() for any of the clusters.


The documentation for this class was generated from the following file:
BerliOS Developer Logo Valid XHTML 1.0 Transitional Valid CSS!