org.encog.neural.networks.training.lma
Class LevenbergMarquardtTraining

java.lang.Object
  extended by org.encog.ml.train.BasicTraining
      extended by org.encog.neural.networks.training.lma.LevenbergMarquardtTraining
All Implemented Interfaces:
MLTrain

public class LevenbergMarquardtTraining
extends BasicTraining

Trains a neural network using a Levenberg Marquardt algorithm (LMA). This training technique is based on the mathematical technique of the same name. http://en.wikipedia.org/wiki/Levenberg%E2%80%93Marquardt_algorithm The LMA training technique has some important limitations that you should be aware of, before using it. Only neural networks that have a single output neuron can be used with this training technique. The entire training set must be loaded into memory. Because of this an Indexable training set must be used. However, despite these limitations, the LMA training technique can be a very effective training method. References: - http://www-alg.ist.hokudai.ac.jp/~jan/alpha.pdf - http://www.inference.phy.cam.ac.uk/mackay/Bayes_FAQ.html ---------------------------------------------------------------- This implementation of the Levenberg Marquardt algorithm is based heavily on code published in an article by Cesar Roberto de Souza. The original article can be found here: http://crsouza.blogspot.com/2009/11/neural-network-learning-by-levenberg_18.html Portions of this class are under the following copyright/license. Copyright 2009 by Cesar Roberto de Souza, Released under the LGPL.


Field Summary
static double LAMBDA_MAX
          The max amount for the LAMBDA.
static int NUM_POINTS
          Number of points for finite difference.
static double SCALE_LAMBDA
          The amount to scale the lambda by.
 
Constructor Summary
LevenbergMarquardtTraining(BasicNetwork network, MLDataSet training)
          Construct the LMA object.
 
Method Summary
 void calculateHessian()
          Calculate the Hessian matrix.
 boolean canContinue()
           
 MLMethod getMethod()
          Get the current best machine learning method from the training.
 void iteration()
          Perform one iteration.
 TrainingContinuation pause()
          Pause the training to continue later.
 void resume(TrainingContinuation state)
          Resume training.
static double trace(double[][] m)
          Return the sum of the diagonal.
 void updateWeights()
          Update the weights.
 
Methods inherited from class org.encog.ml.train.BasicTraining
addStrategy, finishTraining, getError, getImplementationType, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, preIteration, setError, setIteration, setTraining
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCALE_LAMBDA

public static final double SCALE_LAMBDA
The amount to scale the lambda by.

See Also:
Constant Field Values

LAMBDA_MAX

public static final double LAMBDA_MAX
The max amount for the LAMBDA.

See Also:
Constant Field Values

NUM_POINTS

public static final int NUM_POINTS
Number of points for finite difference.

See Also:
Constant Field Values
Constructor Detail

LevenbergMarquardtTraining

public LevenbergMarquardtTraining(BasicNetwork network,
                                  MLDataSet training)
Construct the LMA object.

Parameters:
network - The network to train. Must have a single output neuron.
training - The training data to use. Must be indexable.
Method Detail

trace

public static double trace(double[][] m)
Return the sum of the diagonal.

Parameters:
m - The matrix to sum.
Returns:
The trace of the matrix.

calculateHessian

public void calculateHessian()
Calculate the Hessian matrix.


canContinue

public boolean canContinue()
Returns:
True if the training can be paused, and later continued.

getMethod

public MLMethod getMethod()
Description copied from interface: MLTrain
Get the current best machine learning method from the training.

Returns:
The trained network.

iteration

public void iteration()
Perform one iteration.


pause

public TrainingContinuation pause()
Pause the training to continue later.

Returns:
A training continuation object.

resume

public void resume(TrainingContinuation state)
Resume training.

Parameters:
state - The training continuation object to use to continue.

updateWeights

public void updateWeights()
Update the weights.



Copyright © 2011. All Rights Reserved.