# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.hmm

## Class HiddenMarkovModel

• ### Constructor Summary

Constructors
Constructor and Description
HiddenMarkovModel(HMMRNG hmm)
HiddenMarkovModel(Vector PI, Matrix A, RandomNumberGenerator[] B)
• ### Method Summary

All Methods
Modifier and Type Method and Description
abstract double density(int state, double observation)
Gets the (conditional) probability density/mass of making an observation in a particular state.
double logProbability(HmmInnovation[] innovations)
Gets the probability of observing the observations and having gone thru the state sequence.
double logProbability(int[] states, double[] obsverations)
Gets the probability of observing the observations and having gone thru the state sequence.
double logProbability(int[] states, int[] obsverations)
Gets the probability of observing the observations and having gone thru the state sequence.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.hmm.HMMRNG

next, nextDouble, seed
• ### Methods inherited from class com.numericalmethod.suanshu.stats.markovchain.SimpleMC

A, bin, getStationaryProbabilities, nextState, nStates, PI
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### HiddenMarkovModel

public HiddenMarkovModel(Vector PI,
Matrix A,
RandomNumberGenerator[] B)
• #### HiddenMarkovModel

public HiddenMarkovModel(HMMRNG hmm)
• ### Method Detail

• #### density

public abstract double density(int state,
double observation)
Gets the (conditional) probability density/mass of making an observation in a particular state.
Parameters:
state - the hidden state label, counting from 1
observation - the observation value
Returns:
the probability density/mass
• #### logProbability

public double logProbability(int[] states,
double[] obsverations)
Gets the probability of observing the observations and having gone thru the state sequence.
Parameters:
states - a sequence of the hidden states
obsverations - a sequence of corresponding observations
Returns:
the probability of the occurrence
• #### logProbability

public double logProbability(int[] states,
int[] obsverations)
Gets the probability of observing the observations and having gone thru the state sequence.
Parameters:
states - a sequence of the hidden states
obsverations - a sequence of corresponding observations
Returns:
the probability of the occurrence
• #### logProbability

public double logProbability(HmmInnovation[] innovations)
Gets the probability of observing the observations and having gone thru the state sequence.
Parameters:
innovations - a sequence of HMM innovations
Returns:
the probability of the occurrence