pythonhidden-markov-modelsviterbi

Viterbi algorithm without fitting a HMM model, python


I have a set of observation and states that I determined. I'm trying to associate the observations to the states but the hmmlearn library will only decode the observation after fitting the HMM to the observation. The fitting changes the states which is unwanted.

Is there a HMM implementation that doesn't fit the model?


Solution

  • If anyone needs to make a similar HMM with known states, the built-in classes have options to declare which parameters to fit. The default for guassian hmm is

    params='stmc'
    

    It can be changed to only 's' so only the starting probabilities are fitted or even to an empty string and the fit doesn't change anything. If a custom hmm is needed, the created hmm class can overwrite the decode/predict methods and just not require a fit.