be.ac.ulg.montefiore.run.jahmm.learn
Class BaumWelchLearner

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.learn.BaumWelchLearner
Direct Known Subclasses:
BaumWelchScaledLearner

public class BaumWelchLearner
extends java.lang.Object

An implementation of the Baum-Welch learning algorithm. This algorithm finds a HMM that models a set of observation sequences.


Constructor Summary
BaumWelchLearner()
          Initializes a Baum-Welch instance.
 
Method Summary
protected  double[][] estimateGamma(double[][][] xi, ForwardBackwardCalculator fbc)
           
protected
<O extends Observation>
double[][][]
estimateXi(java.util.List<? extends O> sequence, ForwardBackwardCalculator fbc, Hmm<O> hmm)
           
protected
<O extends Observation>
ForwardBackwardCalculator
generateForwardBackwardCalculator(java.util.List<? extends O> sequence, Hmm<O> hmm)
           
 int getNbIterations()
          Returns the number of iterations performed by the learn(be.ac.ulg.montefiore.run.jahmm.Hmm, java.util.List>) method.
<O extends Observation>
Hmm<O>
iterate(Hmm<O> hmm, java.util.List<? extends java.util.List<? extends O>> sequences)
          Performs one iteration of the Baum-Welch algorithm.
<O extends Observation>
Hmm<O>
learn(Hmm<O> initialHmm, java.util.List<? extends java.util.List<? extends O>> sequences)
          Does a fixed number of iterations (see getNbIterations()) of the Baum-Welch algorithm.
 void setNbIterations(int nb)
          Sets the number of iterations performed by the learn(be.ac.ulg.montefiore.run.jahmm.Hmm, java.util.List>) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaumWelchLearner

public BaumWelchLearner()
Initializes a Baum-Welch instance.

Method Detail

iterate

public <O extends Observation> Hmm<O> iterate(Hmm<O> hmm,
                                              java.util.List<? extends java.util.List<? extends O>> sequences)
Performs one iteration of the Baum-Welch algorithm. In one iteration, a new HMM is computed using a previously estimated HMM.

Parameters:
hmm - A previously estimated HMM.
sequences - The observation sequences on which the learning is based. Each sequence must have a length higher or equal to 2.
Returns:
A new, updated HMM.

generateForwardBackwardCalculator

protected <O extends Observation> ForwardBackwardCalculator generateForwardBackwardCalculator(java.util.List<? extends O> sequence,
                                                                                              Hmm<O> hmm)

learn

public <O extends Observation> Hmm<O> learn(Hmm<O> initialHmm,
                                            java.util.List<? extends java.util.List<? extends O>> sequences)
Does a fixed number of iterations (see getNbIterations()) of the Baum-Welch algorithm.

Parameters:
initialHmm - An initial estimation of the expected HMM. This estimate is critical as the Baum-Welch algorithm only find local minima of its likelihood function.
sequences - The observation sequences on which the learning is based. Each sequence must have a length higher or equal to 2.
Returns:
The HMM that best matches the set of observation sequences given (according to the Baum-Welch algorithm).

estimateXi

protected <O extends Observation> double[][][] estimateXi(java.util.List<? extends O> sequence,
                                                          ForwardBackwardCalculator fbc,
                                                          Hmm<O> hmm)

estimateGamma

protected double[][] estimateGamma(double[][][] xi,
                                   ForwardBackwardCalculator fbc)

getNbIterations

public int getNbIterations()
Returns the number of iterations performed by the learn(be.ac.ulg.montefiore.run.jahmm.Hmm, java.util.List>) method.

Returns:
The number of iterations performed.

setNbIterations

public void setNbIterations(int nb)
Sets the number of iterations performed by the learn(be.ac.ulg.montefiore.run.jahmm.Hmm, java.util.List>) method.

Parameters:
nb - The (positive) number of iterations to perform.


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