org.encog.ml.train
Class BasicTraining

java.lang.Object
  extended by org.encog.ml.train.BasicTraining
All Implemented Interfaces:
MLTrain
Direct Known Subclasses:
BasicTrainSOM, CrossTraining, FreeformPropagationTraining, LevenbergMarquardtTraining, MLMethodGeneticAlgorithm, NelderMeadTraining, NeuralPSO, NeuralSimulatedAnnealing, Propagation, SOMClusterCopyTraining, SVDTraining, SVMSearchTrain, SVMTrain, TrainAdaline, TrainBasicPNN, TrainBayesian, TrainGaussian, TrainInstar, TrainLinearRegression, TrainOutstar

public abstract class BasicTraining
extends Object
implements MLTrain

An abstract class that implements basic training for most training algorithms. Specifically training strategies can be added to enhance the training.

Author:
jheaton

Constructor Summary
BasicTraining()
          Used for serialization.
BasicTraining(TrainingImplementationType implementationType)
           
 
Method Summary
 void addStrategy(Strategy strategy)
          Training strategies can be added to improve the training results.
 void finishTraining()
          Should be called after training has completed and the iteration method will not be called any further.
 double getError()
          
 TrainingImplementationType getImplementationType()
           
 int getIteration()
           
 List<Strategy> getStrategies()
           
 MLDataSet getTraining()
           
 boolean isTrainingDone()
           
 void iteration(int count)
          Perform the specified number of training iterations.
 void postIteration()
          Call the strategies after an iteration.
 void preIteration()
          Call the strategies before an iteration.
 void setError(double error)
           
 void setIteration(int iteration)
          Set the current training iteration.
 void setTraining(MLDataSet training)
          Set the training object that this strategy is working with.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.encog.ml.train.MLTrain
canContinue, getMethod, iteration, pause, resume
 

Constructor Detail

BasicTraining

public BasicTraining()
Used for serialization.


BasicTraining

public BasicTraining(TrainingImplementationType implementationType)
Method Detail

addStrategy

public void addStrategy(Strategy strategy)
Training strategies can be added to improve the training results. There are a number to choose from, and several can be used at once.

Specified by:
addStrategy in interface MLTrain
Parameters:
strategy - The strategy to add.

finishTraining

public void finishTraining()
Should be called after training has completed and the iteration method will not be called any further.

Specified by:
finishTraining in interface MLTrain

getError

public double getError()

Specified by:
getError in interface MLTrain
Returns:
Returns the training error. This value is calculated as the training data is evaluated by the iteration function. This has two important ramifications. First, the value returned by getError() is meaningless prior to a call to iteration. Secondly, the error is calculated BEFORE training is applied by the call to iteration. The timing of the error calculation is done for performance reasons.

getIteration

public int getIteration()
Specified by:
getIteration in interface MLTrain
Returns:
the iteration

getStrategies

public List<Strategy> getStrategies()
Specified by:
getStrategies in interface MLTrain
Returns:
The strategies to use.

getTraining

public MLDataSet getTraining()
Specified by:
getTraining in interface MLTrain
Returns:
The training data to use.

isTrainingDone

public boolean isTrainingDone()
Specified by:
isTrainingDone in interface MLTrain
Returns:
True if training can progress no further.

iteration

public void iteration(int count)
Perform the specified number of training iterations. This is a basic implementation that just calls iteration the specified number of times. However, some training methods, particularly with the GPU, benefit greatly by calling with higher numbers than 1.

Specified by:
iteration in interface MLTrain
Parameters:
count - The number of training iterations.

postIteration

public void postIteration()
Call the strategies after an iteration.


preIteration

public void preIteration()
Call the strategies before an iteration.


setError

public void setError(double error)
Specified by:
setError in interface MLTrain
Parameters:
error - Set the current error rate. This is usually used by training strategies.

setIteration

public void setIteration(int iteration)
Description copied from interface: MLTrain
Set the current training iteration.

Specified by:
setIteration in interface MLTrain
Parameters:
iteration - the iteration to set

setTraining

public void setTraining(MLDataSet training)
Set the training object that this strategy is working with.

Parameters:
training - The training object.

getImplementationType

public TrainingImplementationType getImplementationType()
Specified by:
getImplementationType in interface MLTrain
Returns:
The training implementation type.


Copyright © 2014. All Rights Reserved.