org.neuroph.nnet.learning
Class SimulatedAnnealingLearning

java.lang.Object
  extended by org.neuroph.core.learning.LearningRule
      extended by org.neuroph.core.learning.IterativeLearning
          extended by org.neuroph.core.learning.SupervisedLearning
              extended by org.neuroph.nnet.learning.SimulatedAnnealingLearning
All Implemented Interfaces:
Serializable

public class SimulatedAnnealingLearning
extends SupervisedLearning

This class implements a simulated annealing learning rule for supervised 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 SupervisedLearning interface. Simulated annealing is a common training method. It is often used in conjunction with a propagation training method. Simulated annealing can be very good when propagation training has reached a local minimum. The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one.

Author:
Jeff Heaton (http://www.jeffheaton.com)
See Also:
Serialized Form

Field Summary
protected  NeuralNetwork network
          The neural network that is to be trained.
protected  double temperature
          The current temperature.
 
Fields inherited from class org.neuroph.core.learning.SupervisedLearning
maxError, outputError, previousEpochError, totalNetworkError, totalSquaredErrorSum
 
Fields inherited from class org.neuroph.core.learning.IterativeLearning
currentIteration, iterationsLimited, learningRate, maxIterations
 
Fields inherited from class org.neuroph.core.learning.LearningRule
listeners, neuralNetwork
 
Constructor Summary
SimulatedAnnealingLearning(NeuralNetwork network)
           
SimulatedAnnealingLearning(NeuralNetwork network, double startTemp, double stopTemp, int cycles)
          Construct a simulated annleaing trainer for a feedforward neural network.
 
Method Summary
protected  void addToSquaredErrorSum(double[] patternError)
          Calculates and updates sum of squared errors for single pattern, and updates total sum of squared pattern errors
 void doLearningEpoch(DataSet trainingSet)
          Perform one simulated annealing epoch.
 NeuralNetwork getNetwork()
          Get the best network from the training.
 void randomize()
          Randomize the weights and thresholds.
protected  void updateNetworkWeights(double[] patternError)
          Not used.
protected  void updateTotalNetworkError(double[] patternError)
          Update the total error.
 
Methods inherited from class org.neuroph.core.learning.SupervisedLearning
afterEpoch, beforeEpoch, calculateOutputError, doBatchWeightsUpdate, errorChangeStalled, getMaxError, getMinErrorChange, getMinErrorChangeIterationsCount, getMinErrorChangeIterationsLimit, getPreviousEpochError, getTotalNetworkError, hasReachedStopCondition, isInBatchMode, learn, learn, learnPattern, onStart, setBatchMode, setMaxError, setMinErrorChange, setMinErrorChangeIterationsLimit
 
Methods inherited from class org.neuroph.core.learning.IterativeLearning
doOneLearningIteration, getCurrentIteration, getLearningRate, isPausedLearning, learn, learn, pause, resume, setLearningRate, setMaxIterations
 
Methods inherited from class org.neuroph.core.learning.LearningRule
addListener, fireLearningEvent, getNeuralNetwork, getTrainingSet, isStopped, removeListener, setNeuralNetwork, setTrainingSet, stopLearning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

network

protected NeuralNetwork network
The neural network that is to be trained.


temperature

protected double temperature
The current temperature.

Constructor Detail

SimulatedAnnealingLearning

public SimulatedAnnealingLearning(NeuralNetwork 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.

SimulatedAnnealingLearning

public SimulatedAnnealingLearning(NeuralNetwork network)
Method Detail

addToSquaredErrorSum

protected void addToSquaredErrorSum(double[] patternError)
Description copied from class: SupervisedLearning
Calculates and updates sum of squared errors for single pattern, and updates total sum of squared pattern errors

Overrides:
addToSquaredErrorSum in class SupervisedLearning
Parameters:
patternError - output error vector

getNetwork

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

Returns:
The best network.

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.


doLearningEpoch

public void doLearningEpoch(DataSet trainingSet)
Perform one simulated annealing epoch.

Overrides:
doLearningEpoch in class SupervisedLearning
Parameters:
trainingSet - training set for training network

updateTotalNetworkError

protected void updateTotalNetworkError(double[] patternError)
Update the total error.


updateNetworkWeights

protected void updateNetworkWeights(double[] patternError)
Not used.

Specified by:
updateNetworkWeights in class SupervisedLearning
Parameters:
patternError - output error vector for some network input (aka. patternError, network error) usually the difference between desired and actual output
See Also:
calculateOutputError, SupervisedLearning.addToSquaredErrorSum(double[])


Copyright © 2012. All Rights Reserved.