org.encog.ml.train.strategy.end
Class StoppingStrategy
- java.lang.Object
-
- org.encog.ml.train.strategy.end.StoppingStrategy
-
- All Implemented Interfaces:
- EndTrainingStrategy, Strategy
public class StoppingStrategy extends java.lang.Object implements EndTrainingStrategy
A simple early stopping strategy that halts training when the training set no longer improves.
-
-
Constructor Summary
Constructors Constructor and Description StoppingStrategy(int theAllowedStagnantIterations)StoppingStrategy(MLDataSet theValidationSet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetAllowedStagnantIterations()MLRegressiongetBestModel()doublegetMinimumImprovement()intgetStagnantIterations()voidinit(MLTrain theTrain)Initialize this strategy.booleanisSaveBest()voidpostIteration()Called just after a training iteration.voidpreIteration()Called just before a training iteration.voidsetAllowedStagnantIterations(int allowedStagnantIterations)voidsetMinimumImprovement(double minimumImprovement)voidsetSaveBest(boolean saveBest)voidsetStagnantIterations(int stagnantIterations)booleanshouldStop()
-
-
-
Constructor Detail
-
StoppingStrategy
public StoppingStrategy(MLDataSet theValidationSet)
-
StoppingStrategy
public StoppingStrategy(int theAllowedStagnantIterations)
-
-
Method Detail
-
init
public void init(MLTrain theTrain)
Initialize this strategy.
-
preIteration
public void preIteration()
Called just before a training iteration.- Specified by:
preIterationin interfaceStrategy
-
postIteration
public void postIteration()
Called just after a training iteration.- Specified by:
postIterationin interfaceStrategy
-
shouldStop
public boolean shouldStop()
- Specified by:
shouldStopin interfaceEndTrainingStrategy- Returns:
- Returns true if we should stop.
-
getStagnantIterations
public int getStagnantIterations()
-
setStagnantIterations
public void setStagnantIterations(int stagnantIterations)
-
getAllowedStagnantIterations
public int getAllowedStagnantIterations()
-
setAllowedStagnantIterations
public void setAllowedStagnantIterations(int allowedStagnantIterations)
-
isSaveBest
public boolean isSaveBest()
-
setSaveBest
public void setSaveBest(boolean saveBest)
-
getBestModel
public MLRegression getBestModel()
-
getMinimumImprovement
public double getMinimumImprovement()
-
setMinimumImprovement
public void setMinimumImprovement(double minimumImprovement)
-
-
DMelt 3.0 © DataMelt by jWork.ORG