org.wiigee.logic
Class PreciseHMM

java.lang.Object
  extended by org.wiigee.logic.PreciseHMM

public class PreciseHMM
extends java.lang.Object

This is a Hidden Markov Model implementation which internally provides the basic algorithms for training and recognition (forward and backward algorithm). Since a regular Hidden Markov Model doesn't provide a possibility to train multiple sequences, this implementation has been optimized for this purposes using some state-of-the-art technologies described in several papers.


Field Summary
 double[][] a
          The state change probability to switch from state A to state B: a[stateA][stateB]
 double[][] b
          The probability to emit symbol S in state A: b[stateA][symbolS]
 double[] pi
          The initial probabilities for each state: p[state]
 
Constructor Summary
PreciseHMM(int numStates, int sigmaSize)
          Initialize the Hidden Markov Model in a left-to-right version.
 
Method Summary
 double[][] getA()
           
 double[][] getB()
           
 double getProbability(int[] o)
          Returns the probability that a observation sequence O belongs to this Hidden Markov Model without using the bayes classifier.
 void print()
          Prints everything about this model, including all values.
 double scaledViterbi(int[] o)
           
 void setA(double[][] a)
           
 void setB(double[][] b)
           
 double sProbability(int[] o)
           
 void train(java.util.Vector<int[]> trainsequence)
          Trains the Hidden Markov Model with multiple sequences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pi

public double[] pi
The initial probabilities for each state: p[state]


a

public double[][] a
The state change probability to switch from state A to state B: a[stateA][stateB]


b

public double[][] b
The probability to emit symbol S in state A: b[stateA][symbolS]

Constructor Detail

PreciseHMM

public PreciseHMM(int numStates,
                  int sigmaSize)
Initialize the Hidden Markov Model in a left-to-right version.

Parameters:
numStates - Number of states
sigmaSize - Number of observations
Method Detail

train

public void train(java.util.Vector<int[]> trainsequence)
Trains the Hidden Markov Model with multiple sequences. This method is normally not known to basic hidden markov models, because they usually use the Baum-Welch-Algorithm. This method is NOT the traditional Baum-Welch-Algorithm. If you want to know in detail how it works please consider my Individuelles Projekt paper on the wiigee Homepage. Also there exist some english literature on the world wide web. Try to search for some papers by Rabiner or have a look at Vesa-Matti Mäntylä - "Discrete Hidden Markov Models with application to isolated user-dependent hand gesture recognition".


getProbability

public double getProbability(int[] o)
Returns the probability that a observation sequence O belongs to this Hidden Markov Model without using the bayes classifier. Internally the well known forward algorithm is used.

Parameters:
o - observation sequence
Returns:
probability that sequence o belongs to this hmm

sProbability

public double sProbability(int[] o)

scaledViterbi

public double scaledViterbi(int[] o)

print

public void print()
Prints everything about this model, including all values. For debug purposes or if you want to comprehend what happend to the model.


getA

public double[][] getA()

setA

public void setA(double[][] a)

getB

public double[][] getB()

setB

public void setB(double[][] b)