org.encog.ml.train
Class BasicTraining
- java.lang.Object
-
- org.encog.ml.train.BasicTraining
-
- All Implemented Interfaces:
- MLTrain
- Direct Known Subclasses:
- BasicTrainSOM, CrossTraining, FreeformPropagationTraining, LevenbergMarquardtTraining, MLMethodGeneticAlgorithm, NelderMeadTraining, NeuralPSO, NeuralSimulatedAnnealing, Propagation, SOMClusterCopyTraining, StochasticGradientDescent, SVDTraining, SVMSearchTrain, SVMTrain, TrainAdaline, TrainBasicPNN, TrainBayesian, TrainGaussian, TrainInstar, TrainLinearRegression, TrainOutstar
public abstract class BasicTraining extends java.lang.Object implements MLTrain
An abstract class that implements basic training for most training algorithms. Specifically training strategies can be added to enhance the training.
-
-
Constructor Summary
Constructors Constructor and Description BasicTraining()Used for serialization.BasicTraining(TrainingImplementationType implementationType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddStrategy(Strategy strategy)Training strategies can be added to improve the training results.voidfinishTraining()Should be called after training has completed and the iteration method will not be called any further.doublegetError()TrainingImplementationTypegetImplementationType()intgetIteration()java.util.List<Strategy>getStrategies()MLDataSetgetTraining()booleanisTrainingDone()voiditeration(int count)Perform the specified number of training iterations.voidpostIteration()Call the strategies after an iteration.voidpreIteration()Call the strategies before an iteration.voidsetError(double error)voidsetIteration(int iteration)Set the current training iteration.voidsetTraining(MLDataSet training)Set the training object that this strategy is working with.
-
-
-
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:
addStrategyin interfaceMLTrain- 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:
finishTrainingin interfaceMLTrain
-
getError
public double getError()
- Specified by:
getErrorin interfaceMLTrain- 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:
getIterationin interfaceMLTrain- Returns:
- the iteration
-
getStrategies
public java.util.List<Strategy> getStrategies()
- Specified by:
getStrategiesin interfaceMLTrain- Returns:
- The strategies to use.
-
getTraining
public MLDataSet getTraining()
- Specified by:
getTrainingin interfaceMLTrain- Returns:
- The training data to use.
-
isTrainingDone
public boolean isTrainingDone()
- Specified by:
isTrainingDonein interfaceMLTrain- 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.
-
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)
-
setIteration
public void setIteration(int iteration)
Description copied from interface:MLTrainSet the current training iteration.- Specified by:
setIterationin interfaceMLTrain- 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:
getImplementationTypein interfaceMLTrain- Returns:
- The training implementation type.
-
-
DMelt 3.0 © DataMelt by jWork.ORG