latest version v1.9 - last update 10 Apr 2010 |
Hidden Markov Model (HMM) class. More...
#include <ltiHiddenMarkovModel.h>
Classes | |
class | singleDensity |
This class represents a single multivariate (ie multidimensional ) score density function within a state of a hidden markov model. More... | |
Public Types | |
enum | scoreType |
typedef std::vector < singleDensity > | mixtureDensity |
typedef std::vector < mixtureDensity > | stateList |
Public Member Functions | |
hiddenMarkovModel () | |
hiddenMarkovModel (const hiddenMarkovModel &other) | |
virtual | ~hiddenMarkovModel () |
hiddenMarkovModel & | copy (const hiddenMarkovModel &other) |
hiddenMarkovModel & | operator= (const hiddenMarkovModel &other) |
const char * | getTypeName () const |
int | getNumberOfStates () const |
virtual bool | write (ioHandler &handler, const bool complete=true) const |
virtual bool | read (ioHandler &handler, const bool complete=true) |
Public Attributes | |
User defined | |
std::string | name |
dvector | featureWeights |
double | emissionScoreWeight |
Generated by hmmTrainer | |
These members are usually estimated over a given data set by an automatic training algorithm (see hmmTrainer) | |
scoreType | scoreFunction |
stateList | states |
int | featureDimension |
dvector | initialScore |
dmatrix | transitionScore |
Static Public Attributes | |
static const double | INFINITE_NUMBER |
Hidden Markov Model (HMM) class.
A HMM can be created using the class hmmTrainer, which estimates the HMM parameters A, B, Pi
. These stand for the transitions the emissions in the model states, and the initial probabilities.
For an introduction see: L. Rabiner and B.-H. Juang, "An introduction to hidden markov models", IEEE ASSP Magazine no.1, vol.3, pp4-16, 1986.
For computational efficiency probabilities p are not explicitly computed but represented by scores (~ -ln(p)). Note that a high score corresponds to a low probability, i.e. it rather resembles a cost.
typedef std::vector<singleDensity> lti::hiddenMarkovModel::mixtureDensity |
A mixture density.
Composed of single densities to represent the distribution within one state
typedef std::vector<mixtureDensity> lti::hiddenMarkovModel::stateList |
States of the model, where each state contains a mixture density.
Density type used.
Currently gauss or laplace are available.
lti::hiddenMarkovModel::hiddenMarkovModel | ( | ) |
default constructor
lti::hiddenMarkovModel::hiddenMarkovModel | ( | const hiddenMarkovModel & | other | ) |
copy constructor
other | the hiddenMarkovModel to be copied |
virtual lti::hiddenMarkovModel::~hiddenMarkovModel | ( | ) | [virtual] |
destructor
hiddenMarkovModel& lti::hiddenMarkovModel::copy | ( | const hiddenMarkovModel & | other | ) |
copy data of "other" hiddenMarkovModel.
Please note that the status string will _NOT_ be copied!
Reimplemented from lti::ioObject.
int lti::hiddenMarkovModel::getNumberOfStates | ( | ) | const |
Returns the number of states of this model.
const char* lti::hiddenMarkovModel::getTypeName | ( | ) | const [virtual] |
returns name of this type
Reimplemented from lti::ioObject.
hiddenMarkovModel& lti::hiddenMarkovModel::operator= | ( | const hiddenMarkovModel & | other | ) |
assigment operator (alias for copy(other)).
other | the hiddenMarkovModel to be copied |
Reimplemented from lti::ioObject.
virtual bool lti::hiddenMarkovModel::read | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | [virtual] |
read the parameters from the given ioHandler
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
Reimplemented from lti::ioObject.
virtual bool lti::hiddenMarkovModel::write | ( | ioHandler & | handler, | |
const bool | complete = true | |||
) | const [virtual] |
write the parameters in the given ioHandler
handler | the ioHandler to be used | |
complete | if true (the default) the enclosing begin/end will be also written, otherwise only the data block will be written. |
Reimplemented from lti::ioObject.
Relative weight of the emission scores compared to the initial and transition score.
Can be used to compensate the magnitude difference between those.
Use a value >1.0, to emphasize the emission or a value <1.0 to put more weight into the transitions. Default value is 1.0
Number of dimensions for an observation.
Absolute weight of each feature (dimension).
Default is a vector of 1.0 for all features to indicate equal importance (weights are ignored if number of dimensions differs from featureDimension).
const double lti::hiddenMarkovModel::INFINITE_NUMBER [static] |
This number is considered to be the "impossible" score (score equivalent to a probability of 0.0).
Score for each state being the starting state.
This is the HMM parameter called Pi
std::string lti::hiddenMarkovModel::name |
Name of the model.
Can be used to identify a model by a string.
Specifies the score function to be used.
default: laplaceScore
List of states of the model s_i
.
Generally the number of states is denoted N
. The states contain the emission functions b_i
, known as the HMM parameter called B
Score for each transition.
TransitionScore[a][b] is the score for a transition from state a to b. This is the HMM parameter called A