The Encog Project

org.encog.neural.networks.training.anneal
Class NeuralSimulatedAnnealing

java.lang.Object
  extended by org.encog.neural.networks.training.BasicTraining
      extended by org.encog.neural.networks.training.anneal.NeuralSimulatedAnnealing
All Implemented Interfaces:
Train
Direct Known Subclasses:
NeuralTrainingSetSimulatedAnnealing

public abstract class NeuralSimulatedAnnealing
extends BasicTraining

This class implements a simulated annealing training algorithm for neural networks. It is based on the generic SimulatedAnnealing class. It is used in the same manner as any other training class that implements the Train interface. This class is abstract, to create your own version of simulated annealing, you must provide an implementation of the determineError method. If you want to train with a training set, use the NeuralTrainingSetSimulatedAnnealing class.


Field Summary
static double CUT
          The cutoff for random data.
 
Constructor Summary
NeuralSimulatedAnnealing(BasicNetwork network, double startTemp, double stopTemp, int cycles)
          Construct a simulated annleaing trainer for a feedforward neural network.
 
Method Summary
abstract  double determineError()
          Determine the error of the current weights and thresholds.
 java.lang.Double[] getArray()
          Get the network as an array of doubles.
 java.lang.Double[] getArrayCopy()
           
 BasicNetwork getNetwork()
          Get the best network from the training.
 void iteration()
          Perform one iteration of simulated annealing.
 void putArray(java.lang.Double[] array)
          Convert an array of doubles to the current best network.
 void randomize()
          Randomize the weights and thresholds.
 
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
 

Field Detail

CUT

public static final double CUT
The cutoff for random data.

See Also:
Constant Field Values
Constructor Detail

NeuralSimulatedAnnealing

public NeuralSimulatedAnnealing(BasicNetwork network,
                                double startTemp,
                                double stopTemp,
                                int cycles)
Construct a simulated annleaing trainer for a feedforward neural network.

Parameters:
network - The neural network to be trained.
startTemp - The starting temperature.
stopTemp - The ending temperature.
cycles - The number of cycles in a training iteration.
Method Detail

getNetwork

public BasicNetwork getNetwork()
Get the best network from the training.

Returns:
The best network.

iteration

public void iteration()
Perform one iteration of simulated annealing.


determineError

public abstract double determineError()
Determine the error of the current weights and thresholds.

Returns:
The error.

getArray

public java.lang.Double[] getArray()
Get the network as an array of doubles.

Returns:
The network as an array of doubles.

getArrayCopy

public java.lang.Double[] getArrayCopy()
Returns:
A copy of the annealing array.

putArray

public void putArray(java.lang.Double[] array)
Convert an array of doubles to the current best network.

Parameters:
array - An array.

randomize

public void randomize()
Randomize the weights and thresholds. This function does most of the work of the class. Each call to this class will randomize the data according to the current temperature. The higher the temperature the more randomness.


The Encog Project