be.ac.ulg.montefiore.run.jahmm.learn
Class KMeansLearner<O extends Observation & CentroidFactory<? super O>>

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.learn.KMeansLearner<O>

public class KMeansLearner<O extends Observation & CentroidFactory<? super O>>
extends java.lang.Object

An implementation of the K-Means learning algorithm.


Constructor Summary
KMeansLearner(int nbStates, OpdfFactory<? extends Opdf<O>> opdfFactory, java.util.List<? extends java.util.List<? extends O>> sequences)
          Initializes a K-Means algorithm implementation.
 
Method Summary
 boolean isTerminated()
          Returns true if the algorithm has reached a fix point, else returns false.
 Hmm<O> iterate()
          Performs one iteration of the K-Means algorithm.
 Hmm<O> learn()
          Does iterations of the K-Means algorithm until a fix point is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeansLearner

public KMeansLearner(int nbStates,
                     OpdfFactory<? extends Opdf<O>> opdfFactory,
                     java.util.List<? extends java.util.List<? extends O>> sequences)
Initializes a K-Means algorithm implementation. This algorithm finds a HMM that models a set of observation sequences.

Parameters:
nbStates - The number of states the resulting HMM will be made of.
opdfFactory - A class that builds the observation probability distributions associated to the states of the HMM.
sequences - A vector of observation sequences. Each observation sequences is a vector of observations compatible with the k-means algorithm.
Method Detail

iterate

public Hmm<O> iterate()
Performs one iteration of the K-Means algorithm. In one iteration, a new HMM is computed using the current clusters, and the clusters are re-estimated using this HMM.

Returns:
A new, updated HMM.

isTerminated

public boolean isTerminated()
Returns true if the algorithm has reached a fix point, else returns false.


learn

public Hmm<O> learn()
Does iterations of the K-Means algorithm until a fix point is reached.

Returns:
The HMM that best matches the set of observation sequences given (according to the K-Means algorithm).


Copyright © 2004,2005 Jean-Marc François.