mlpack.hmm_viterbi
hmm_viterbi(...)Hidden Markov Model (HMM) Viterbi State Prediction
>>> from mlpack import hmm_viterbi
This utility takes an already-trained HMM, specified as 'input_model', and evaluates the most probable hidden state sequence of a given sequence of observations (specified as ''input', using the Viterbi algorithm. The computed state sequence may be saved using the 'output' output parameter.
For example, to predict the state sequence of the observations 'obs' using the HMM 'hmm', storing the predicted state sequence to 'states', the following command could be used:
>>> hmm_viterbi(input=obs, input_model=hmm)
>>> states = output['output']
input options
- input (numpy matrix or arraylike, float dtype): [required] Matrix containing observations,
- input_model (mlpack.HMMModelType): [required] Trained HMM to use.
- copy_all_inputs (bool): If specified, all input parameters will be deep copied before the method is run. This is useful for debugging problems where the input parameters are being modified by the algorithm, but can slow down the code.
- verbose (bool): Display informational messages and the full list of parameters and timers at the end of execution.
output options
The return value from the binding is a dict containing the following elements:
- output (numpy matrix, int dtype): File to save predicted state sequence to.