The Encog Project

org.encog.neural.networks.training.propagation.back
Class Backpropagation

java.lang.Object
  extended by org.encog.neural.networks.training.BasicTraining
      extended by org.encog.neural.networks.training.propagation.Propagation
          extended by org.encog.neural.networks.training.propagation.back.Backpropagation
All Implemented Interfaces:
LearningRate, Momentum, Train

public class Backpropagation
extends Propagation
implements Momentum, LearningRate

This class implements a backpropagation training algorithm for feed forward neural networks. It is used in the same manner as any other training class that implements the Train interface. Backpropagation is a common neural network training algorithm. It works by analyzing the error of the output of the neural network. Each neuron in the output layer's contribution, according to weight, to this error is determined. These weights are then adjusted to minimize this error. This process continues working its way backwards through the layers of the neural network. This implementation of the backpropagation algorithm uses both momentum and a learning rate. The learning rate specifies the degree to which the weight matrixes will be modified through each iteration. The momentum specifies how much the previous learning iteration affects the current. To use no momentum at all specify zero. One primary problem with backpropagation is that the magnitude of the partial derivative is often detrimental to the training of the neural network. The other propagation methods of Manhatten and Resilient address this issue in different ways. In general, it is suggested that you use the resilient propagation technique for most Encog training tasks over back propagation.


Constructor Summary
Backpropagation(BasicNetwork network, NeuralDataSet training)
          Create a class to train using backpropagation.
Backpropagation(BasicNetwork network, NeuralDataSet training, double learnRate, double momentum)
           
 
Method Summary
 double getLearningRate()
           
 double getMomentum()
           
 void performIteration(CalculateGradient prop, double[] weights)
          Perform a training iteration.
 void setLearningRate(double rate)
          Set the learning rate, this is value is essentially a percent.
 void setMomentum(double m)
          Set the momentum for training.
 
Methods inherited from class org.encog.neural.networks.training.propagation.Propagation
canContinue, getNetwork, getNumThreads, isValidResume, iteration, pause, resume, setNumThreads
 
Methods inherited from class org.encog.neural.networks.training.BasicTraining
addStrategy, finishTraining, getError, getStrategies, getTraining, postIteration, preIteration, setError, setTraining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Backpropagation

public Backpropagation(BasicNetwork network,
                       NeuralDataSet training)
Create a class to train using backpropagation.

Parameters:
network - The network that is to be trained.
training - The training data to be used for backpropagation.

Backpropagation

public Backpropagation(BasicNetwork network,
                       NeuralDataSet training,
                       double learnRate,
                       double momentum)
Parameters:
network - The network that is to be trained
training - The training set
learnRate - The rate at which the weight matrix will be adjusted based on learning.
momentum - The influence that previous iteration's training deltas will have on the current iteration.
Method Detail

getLearningRate

public double getLearningRate()
Specified by:
getLearningRate in interface LearningRate
Returns:
The learning rate, this is value is essentially a percent. It is the degree to which the gradients are applied to the weight matrix to allow learning.

getMomentum

public double getMomentum()
Specified by:
getMomentum in interface Momentum
Returns:
The momentum for training. This is the degree to which changes from which the previous training iteration will affect this training iteration. This can be useful to overcome local minima.

performIteration

public void performIteration(CalculateGradient prop,
                             double[] weights)
Perform a training iteration. This is where the actual backprop specific training takes place.

Specified by:
performIteration in class Propagation
Parameters:
prop - The gradients.
weights - The network weights.

setLearningRate

public void setLearningRate(double rate)
Set the learning rate, this is value is essentially a percent. It is the degree to which the gradients are applied to the weight matrix to allow learning.

Specified by:
setLearningRate in interface LearningRate
Parameters:
rate - The learning rate.

setMomentum

public void setMomentum(double m)
Set the momentum for training. This is the degree to which changes from which the previous training iteration will affect this training iteration. This can be useful to overcome local minima.

Specified by:
setMomentum in interface Momentum
Parameters:
m - The momentum.

The Encog Project