ocvolume.hmm
Class markov

java.lang.Object
  |
  +--ocvolume.hmm.markov

public class markov
extends java.lang.Object

last updated on June 15, 2002
description: this class represents a left-to-right Hidden Markov Model and its essential methods for speech recognition. The collection of methods include Forward-Backward Algorithm, Baum-Welch Algorithm, Scaling, Viterbi, etc.
calls: none
called by: volume, train
input: sequence of integers
output: probability


Field Summary
protected  double[][] alpha
          forward variable alpha
protected  double[][] beta
          backward variable beta
protected  int[] currentSeq
          current observation sequence
protected  int delta
          number of states the model is allowed to jump
protected  int len_obSeq
          length of observation sequence
protected  int num_obSeq
          number of observation sequence
protected  int num_states
          number of state in the model example: number of urns
protected  int num_symbols
          number of observation symbols per state example: how many different colour balls there are
protected  int[][] obSeq
          discrete set of observation symbols example: sequence of colour of balls
protected  double[][] output
          discrete output probability example: probability of a specific output from a state
protected  double[] pi
          initial state distribution example: which state is the starting state
 int[] q
          best state sequence
protected  double[] scaleFactor
          Scale Coefficient
protected  double[][] transition
          state transition probability example: probability from one state to another state
 
Constructor Summary
markov(int num_states, int num_symbols)
          class constructor - used to create a left-to-right model with multiple observation sequences for training
calls: none
called by: trainHMM
markov(java.lang.String filepath)
          class constructor - used to create a model from a saved file
calls: none
called by: volume, trainHMM
 
Method Summary
protected  double computeAlpha()
          calculate forward variable alpha
calls: none
called by: markov
protected  void computeBeta()
          calculate backward variable beta for later use with Re-Estimation method
calls: none
called by: markov
 double getProbability(int[] testSeq)
          returns the probability calculated from the testing sequence
calls: none
called by: volume
 void save(java.lang.String filepath)
          save HMM model to file
calls: none
called by: trainHMM
 void setNumObSeq(int k)
          set the number of training sequences
calls: none
called by: trainHMM
 void setObSeq(int[] observationSeq)
          set observation sequence
calls: none
called by: trainHMM
 void setTrainSeq(int[][] trainSeq)
          set training sequences for re-estimation step
calls: none
called by: trainHMM
 void setTrainSeq(int k, int[] trainSeq)
          set a training sequence for re-estimation step
calls: none
called by: trainHMM
 void train()
          train the hmm model until no more improvement
calls: none
called by: trainHMM
 double viterbi(int[] testSeq)
          viterbi algorithm used to get best state sequence and probability
calls: none
called by: volume
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

len_obSeq

protected int len_obSeq
length of observation sequence


num_states

protected int num_states
number of state in the model example: number of urns


num_symbols

protected int num_symbols
number of observation symbols per state example: how many different colour balls there are


delta

protected final int delta
number of states the model is allowed to jump

See Also:
Constant Field Values

obSeq

protected int[][] obSeq
discrete set of observation symbols example: sequence of colour of balls


currentSeq

protected int[] currentSeq
current observation sequence


num_obSeq

protected int num_obSeq
number of observation sequence


transition

protected double[][] transition
state transition probability example: probability from one state to another state


output

protected double[][] output
discrete output probability example: probability of a specific output from a state


pi

protected double[] pi
initial state distribution example: which state is the starting state


alpha

protected double[][] alpha
forward variable alpha


beta

protected double[][] beta
backward variable beta


scaleFactor

protected double[] scaleFactor
Scale Coefficient


q

public int[] q
best state sequence

Constructor Detail

markov

public markov(java.lang.String filepath)
class constructor - used to create a model from a saved file
calls: none
called by: volume, trainHMM

Parameters:
filepath - path of the file to load

markov

public markov(int num_states,
              int num_symbols)
class constructor - used to create a left-to-right model with multiple observation sequences for training
calls: none
called by: trainHMM

Parameters:
num_states - number of states in the model
num_symbols - number of symbols per state
Method Detail

viterbi

public double viterbi(int[] testSeq)
viterbi algorithm used to get best state sequence and probability
calls: none
called by: volume

Parameters:
testSeq - test sequence
Returns:
probability

getProbability

public double getProbability(int[] testSeq)
returns the probability calculated from the testing sequence
calls: none
called by: volume

Parameters:
testSeq - testing sequence
Returns:
probability of observation sequence given the model

computeAlpha

protected double computeAlpha()
calculate forward variable alpha
calls: none
called by: markov

Returns:
probability

computeBeta

protected void computeBeta()
calculate backward variable beta for later use with Re-Estimation method
calls: none
called by: markov


setNumObSeq

public void setNumObSeq(int k)
set the number of training sequences
calls: none
called by: trainHMM

Parameters:
k - number of training sequences

setTrainSeq

public void setTrainSeq(int k,
                        int[] trainSeq)
set a training sequence for re-estimation step
calls: none
called by: trainHMM

Parameters:
k - index representing kth training sequence
trainSeq - training sequence

setTrainSeq

public void setTrainSeq(int[][] trainSeq)
set training sequences for re-estimation step
calls: none
called by: trainHMM

Parameters:
trainSeq - training sequences

train

public void train()
train the hmm model until no more improvement
calls: none
called by: trainHMM


setObSeq

public void setObSeq(int[] observationSeq)
set observation sequence
calls: none
called by: trainHMM

Parameters:
observationSeq - observation sequence

save

public void save(java.lang.String filepath)
save HMM model to file
calls: none
called by: trainHMM

Parameters:
filepath - file location