org.encog.ml.hmm.train.kmeans
Class TrainKMeans

java.lang.Object
  extended by org.encog.ml.hmm.train.kmeans.TrainKMeans
All Implemented Interfaces:
MLTrain

public class TrainKMeans
extends 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
TrainKMeans(HiddenMarkovModel method, MLSequenceSet sequences)
           
 
Method Summary
 void addStrategy(Strategy strategy)
          Training strategies can be added to improve the training results.
 boolean canContinue()
           
 void finishTraining()
          Should be called once training is complete and no more iterations are needed.
 double getError()
           
 TrainingImplementationType getImplementationType()
           
 int getIteration()
           
 MLMethod getMethod()
          Get the current best machine learning method from the training.
 List<Strategy> getStrategies()
           
 MLDataSet getTraining()
           
 boolean isTrainingDone()
           
 void iteration()
          Perform one iteration of training.
 void iteration(int count)
          Perform a number of training iterations.
 TrainingContinuation pause()
          Pause the training to continue later.
 void resume(TrainingContinuation state)
          Resume training.
 void setError(double error)
           
 void setIteration(int iteration)
          Set the current training iteration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrainKMeans

public TrainKMeans(HiddenMarkovModel method,
                   MLSequenceSet sequences)
Method Detail

addStrategy

public void addStrategy(Strategy strategy)
Description copied from interface: MLTrain
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:
addStrategy in interface MLTrain
Parameters:
strategy - The strategy to add.

canContinue

public boolean canContinue()
Specified by:
canContinue in interface MLTrain
Returns:
True if the training can be paused, and later continued.

finishTraining

public void finishTraining()
Description copied from interface: MLTrain
Should 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:
finishTraining in interface MLTrain

getError

public double getError()
Specified by:
getError in interface MLTrain
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:
getImplementationType in interface MLTrain
Returns:
The training implementation type.

getIteration

public int getIteration()
Specified by:
getIteration in interface MLTrain
Returns:
The current training iteration.

getMethod

public MLMethod getMethod()
Description copied from interface: MLTrain
Get the current best machine learning method from the training.

Specified by:
getMethod in interface MLTrain
Returns:
The best machine learningm method.

getStrategies

public List<Strategy> getStrategies()
Specified by:
getStrategies in interface MLTrain
Returns:
The strategies to use.

getTraining

public MLDataSet getTraining()
Specified by:
getTraining in interface MLTrain
Returns:
The training data to use.

isTrainingDone

public boolean isTrainingDone()
Specified by:
isTrainingDone in interface MLTrain
Returns:
True if training can progress no further.

iteration

public void iteration()
Description copied from interface: MLTrain
Perform one iteration of training.

Specified by:
iteration in interface MLTrain

iteration

public void iteration(int count)
Description copied from interface: MLTrain
Perform a number of training iterations.

Specified by:
iteration in interface MLTrain
Parameters:
count - The number of iterations to perform.

pause

public TrainingContinuation pause()
Description copied from interface: MLTrain
Pause the training to continue later.

Specified by:
pause in interface MLTrain
Returns:
A training continuation object.

resume

public void resume(TrainingContinuation state)
Description copied from interface: MLTrain
Resume training.

Specified by:
resume in interface MLTrain
Parameters:
state - The training continuation object to use to continue.

setError

public void setError(double error)
Specified by:
setError in interface MLTrain
Parameters:
error - Set the current error rate. This is usually used by training strategies.

setIteration

public void setIteration(int iteration)
Description copied from interface: MLTrain
Set the current training iteration.

Specified by:
setIteration in interface MLTrain
Parameters:
iteration - Iteration.


Copyright © 2014. All Rights Reserved.