org.encog.ml.hmm.train.bw
Class BaseBaumWelch
- java.lang.Object
-
- org.encog.ml.hmm.train.bw.BaseBaumWelch
-
- All Implemented Interfaces:
- MLTrain
- Direct Known Subclasses:
- TrainBaumWelch, TrainBaumWelchScaled
public abstract class BaseBaumWelch extends java.lang.Object implements MLTrain
This class provides the base implementation for Baum-Welch learning for HMM's. There are currently two implementations provided. TrainBaumWelch - Regular Baum Welch Learning. TrainBaumWelchScaled - Regular Baum Welch Learning, which can handle underflows in long sequences. L. E. Baum, T. Petrie, G. Soules, and N. Weiss, "A maximization technique occurring in the statistical analysis of probabilistic functions of Markov chains" , Ann. Math. Statist., vol. 41, no. 1, pp. 164-171, 1970. Hidden Markov Models and the Baum-Welch Algorithm, IEEE Information Theory Society Newsletter, Dec. 2003.
-
-
Constructor Summary
Constructors Constructor and Description BaseBaumWelch(HiddenMarkovModel hmm, MLSequenceSet training)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidaddStrategy(Strategy strategy)Training strategies can be added to improve the training results.booleancanContinue()abstract double[][][]estimateXi(MLDataSet sequence, ForwardBackwardCalculator fbc, HiddenMarkovModel hmm)voidfinishTraining()Should be called once training is complete and no more iterations are needed.abstract ForwardBackwardCalculatorgenerateForwardBackwardCalculator(MLDataSet sequence, HiddenMarkovModel hmm)doublegetError()TrainingImplementationTypegetImplementationType()intgetIteration()MLMethodgetMethod()Get the current best machine learning method from the training.java.util.List<Strategy>getStrategies()MLDataSetgetTraining()booleanisTrainingDone()voiditeration()Perform one iteration of training.voiditeration(int count)Perform a number of training iterations.TrainingContinuationpause()Pause the training to continue later.voidresume(TrainingContinuation state)Resume training.voidsetError(double error)voidsetIteration(int iteration)Set the current training iteration.
-
-
-
Constructor Detail
-
BaseBaumWelch
public BaseBaumWelch(HiddenMarkovModel hmm, MLSequenceSet training)
-
-
Method Detail
-
addStrategy
public void addStrategy(Strategy strategy)
Description copied from interface:MLTrainTraining 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.
-
canContinue
public boolean canContinue()
- Specified by:
canContinuein interfaceMLTrain- Returns:
- True if the training can be paused, and later continued.
-
estimateXi
public abstract double[][][] estimateXi(MLDataSet sequence, ForwardBackwardCalculator fbc, HiddenMarkovModel hmm)
-
finishTraining
public void finishTraining()
Description copied from interface:MLTrainShould be called once training is complete and no more iterations are needed. Calling iteration again will simply begin the training again, and require finishTraining to be called once the new training session is complete. It is particularly important to call finishTraining for multithreaded training techniques.- Specified by:
finishTrainingin interfaceMLTrain
-
generateForwardBackwardCalculator
public abstract ForwardBackwardCalculator generateForwardBackwardCalculator(MLDataSet sequence, HiddenMarkovModel hmm)
-
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.
-
getImplementationType
public TrainingImplementationType getImplementationType()
- Specified by:
getImplementationTypein interfaceMLTrain- Returns:
- The training implementation type.
-
getIteration
public int getIteration()
- Specified by:
getIterationin interfaceMLTrain- Returns:
- The current training iteration.
-
getMethod
public MLMethod getMethod()
Description copied from interface:MLTrainGet the current best machine learning method from the training.
-
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()
Description copied from interface:MLTrainPerform one iteration of training.
-
iteration
public void iteration(int count)
Description copied from interface:MLTrainPerform a number of training iterations.
-
pause
public TrainingContinuation pause()
Description copied from interface:MLTrainPause the training to continue later.
-
resume
public void resume(TrainingContinuation state)
Description copied from interface:MLTrainResume training.
-
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- Iteration.
-
-
DMelt 3.0 © DataMelt by jWork.ORG