org.encog.ml.hmm.train.kmeans
Class TrainKMeans
- java.lang.Object
-
- org.encog.ml.hmm.train.kmeans.TrainKMeans
-
- All Implemented Interfaces:
- MLTrain
public class TrainKMeans extends java.lang.Object implements MLTrain
Train a Hidden Markov Model (HMM) with the KMeans algorithm. Makes use of KMeans clustering to estimate the transitional and observational probabilities for the HMM. Unlike Baum Welch training, this method does not require a prior estimate of the HMM model, it starts from scratch. Faber, Clustering and the Continuous k-Means Algorithm, Los Alamos Science, no. 22, 1994.
-
-
Constructor Summary
Constructors Constructor and Description TrainKMeans(HiddenMarkovModel method, MLSequenceSet sequences)
-
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.booleancanContinue()voidfinishTraining()Should be called once training is complete and no more iterations are needed.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
-
TrainKMeans
public TrainKMeans(HiddenMarkovModel method, MLSequenceSet sequences)
-
-
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.
-
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
-
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