Classes | |
struct | Path |
struct | SeqInfo |
Public Member Functions | |
HMM (const std::vector< T > &states, const std::vector< T > &observations, const std::string &name="") | |
~HMM () | |
Destructor. | |
void | setStateTransition (const T fromState, const T toState, double prob) |
Set the state transitions. | |
void | setStateEmission (const T state, const T emission, double prob) |
The state emission probability. | |
void | setCurrentState (const T state, double prob) |
Set the current prob of which state we are in. | |
std::vector< T > | getLikelyStates (const std::vector< T > observations, double &maxPathProb=double()) |
void | iteratePath (const T observation) |
Iterate through the path given one observation. | |
double | forward (const std::vector< T > observations) |
Forward alg ie. compute P(Obj | currentHMMModel). | |
double | backward (const std::vector< T > observations) |
Backward alg. | |
void | train (const std::vector< std::vector< T > > observations, size_t numIterations) |
void | train (const std::vector< T > observations, size_t numIterations) |
void | computeXi (const std::vector< T > observations) |
void | computeGamma (const std::vector< T > observations) |
std::vector< T > | getMaxPath (double &maxPathProb) |
Get the max path so far. | |
void | show () |
Show the internal states and observations of the HMM. | |
std::string | getName () |
Get the hmm name. |
Definition at line 51 of file HMM.H.
double HMM< T >::backward | ( | const std::vector< T > | observations | ) | [inline] |
Backward alg.
Definition at line 299 of file HMM.C.
References Image< T >::getVal(), and sum().
Referenced by HMM< T >::train().
double HMM< T >::forward | ( | const std::vector< T > | observations | ) | [inline] |
Forward alg ie. compute P(Obj | currentHMMModel).
Definition at line 237 of file HMM.C.
References Image< T >::getVal(), log(), and sum().
Referenced by HMM< T >::train().
std::vector< T > HMM< T >::getLikelyStates | ( | const std::vector< T > | observations, | |
double & | maxPathProb = double() | |||
) | [inline] |
Find the most likely sequence of hidden states given the observations and return the probability of this path.
Definition at line 162 of file HMM.C.
References HMM< T >::getMaxPath(), and HMM< T >::iteratePath().
std::vector< T > HMM< T >::getMaxPath | ( | double & | maxPathProb | ) | [inline] |
Get the max path so far.
Definition at line 178 of file HMM.C.
Referenced by HMM< T >::getLikelyStates().
std::string HMM< T >::getName | ( | void | ) | [inline] |
void HMM< T >::iteratePath | ( | const T | observation | ) | [inline] |
Iterate through the path given one observation.
Definition at line 201 of file HMM.C.
References Image< T >::getVal().
Referenced by HMM< T >::getLikelyStates().
void HMM< T >::setCurrentState | ( | const T | state, | |
double | prob | |||
) | [inline] |
void HMM< T >::setStateEmission | ( | const T | state, | |
const T | emission, | |||
double | prob | |||
) | [inline] |
The state emission probability.
Definition at line 92 of file HMM.C.
References Image< T >::setVal().
void HMM< T >::setStateTransition | ( | const T | fromState, | |
const T | toState, | |||
double | prob | |||
) | [inline] |
void HMM< T >::show | ( | ) | [inline] |
Show the internal states and observations of the HMM.
Definition at line 114 of file HMM.C.
References Image< T >::getHeight(), Image< T >::getVal(), and Image< T >::getWidth().
void HMM< T >::train | ( | const std::vector< T > | observations, | |
size_t | numIterations | |||
) | [inline] |
Train the model by changing the state transitions and state emittions for the given observation batch update per Fundamentals of Speech Recognition - by Lawrence Rabiner , Biing-Hwang Juang
Definition at line 336 of file HMM.C.
References HMM< T >::backward(), HMM< T >::forward(), and Image< T >::setVal().
void HMM< T >::train | ( | const std::vector< std::vector< T > > | observations, | |
size_t | numIterations | |||
) | [inline] |
Train the model by changing the state transitions and state emittions for the given observation
Definition at line 421 of file HMM.C.
References HMM< T >::backward(), exp(), HMM< T >::forward(), gamma(), and Image< T >::setVal().