org.encog.neural.networks.training.propagation.sgd
Class StochasticGradientDescent
- java.lang.Object
-
- org.encog.ml.train.BasicTraining
-
- org.encog.neural.networks.training.propagation.sgd.StochasticGradientDescent
-
- All Implemented Interfaces:
- MLTrain, LearningRate, Momentum
public class StochasticGradientDescent extends BasicTraining implements Momentum, LearningRate
-
-
Constructor Summary
Constructors Constructor and Description StochasticGradientDescent(ContainsFlat network, MLDataSet training)StochasticGradientDescent(ContainsFlat network, MLDataSet training, GenerateRandom theRandom)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcalculateRegularizationPenalty(double[] l)booleancanContinue()intgetBatchSize()FlatNetworkgetFlat()doublegetL1()doublegetL2()doublegetLearningRate()MLMethodgetMethod()Get the current best machine learning method from the training.doublegetMomentum()UpdateRulegetUpdateRule()booleanisValidResume(TrainingContinuation state)voiditeration()Perform one iteration of training.voidlayerRegularizationPenalty(int fromLayer, double[] l)TrainingContinuationpause()Pause the training.voidpreIteration()Call the strategies before an iteration.voidprocess(MLDataPair pair)voidresetError()voidresume(TrainingContinuation state)Resume training.voidsetBatchSize(int theBatchSize)voidsetL1(double l1)voidsetL2(double l2)voidsetLearningRate(double rate)Set the learning rate.voidsetMomentum(double m)Set the momentum.voidsetUpdateRule(UpdateRule updateRule)voidupdate()-
Methods inherited from class org.encog.ml.train.BasicTraining
addStrategy, finishTraining, getError, getImplementationType, getIteration, getStrategies, getTraining, isTrainingDone, iteration, postIteration, setError, setIteration, setTraining
-
-
-
-
Constructor Detail
-
StochasticGradientDescent
public StochasticGradientDescent(ContainsFlat network, MLDataSet training)
-
StochasticGradientDescent
public StochasticGradientDescent(ContainsFlat network, MLDataSet training, GenerateRandom theRandom)
-
-
Method Detail
-
process
public void process(MLDataPair pair)
-
update
public void update()
-
resetError
public void resetError()
-
iteration
public void iteration()
Description copied from interface:MLTrainPerform one iteration of training.
-
canContinue
public boolean canContinue()
- Specified by:
canContinuein interfaceMLTrain- Returns:
- True if the training can be paused, and later continued.
-
getLearningRate
public double getLearningRate()
- Specified by:
getLearningRatein interfaceLearningRate- Returns:
- The learning rate.
-
getMomentum
public double getMomentum()
- Specified by:
getMomentumin interfaceMomentum- Returns:
- The momentum.
-
isValidResume
public boolean isValidResume(TrainingContinuation state)
-
pause
public TrainingContinuation pause()
Pause the training.
-
resume
public void resume(TrainingContinuation state)
Description copied from interface:MLTrainResume training.
-
getMethod
public MLMethod getMethod()
Description copied from interface:MLTrainGet the current best machine learning method from the training.
-
setLearningRate
public void setLearningRate(double rate)
Description copied from interface:LearningRateSet the learning rate.- Specified by:
setLearningRatein interfaceLearningRate- Parameters:
rate- The new learning rate
-
setMomentum
public void setMomentum(double m)
Description copied from interface:MomentumSet the momentum.- Specified by:
setMomentumin interfaceMomentum- Parameters:
m- The new momentum.
-
preIteration
public void preIteration()
Description copied from class:BasicTrainingCall the strategies before an iteration.- Overrides:
preIterationin classBasicTraining
-
getBatchSize
public int getBatchSize()
-
setBatchSize
public void setBatchSize(int theBatchSize)
-
getL1
public double getL1()
-
setL1
public void setL1(double l1)
-
getL2
public double getL2()
-
setL2
public void setL2(double l2)
-
calculateRegularizationPenalty
public void calculateRegularizationPenalty(double[] l)
-
layerRegularizationPenalty
public void layerRegularizationPenalty(int fromLayer, double[] l)
-
getFlat
public FlatNetwork getFlat()
-
getUpdateRule
public UpdateRule getUpdateRule()
-
setUpdateRule
public void setUpdateRule(UpdateRule updateRule)
-
-
DMelt 3.0 © DataMelt by jWork.ORG