Statsmodels, statistical modeling and econometrics in Python
...The package is released under the open source Modified BSD (3-clause) license. Generalized linear models with support for all of the one-parameter exponential family distributions. Markov switching models (MSAR), also known as Hidden Markov Models (HMM). Vector autoregressive models, VAR and structural VAR. Vector error correction model, VECM. Robust linear models with support for several M-estimators. statsmodels supports specifying models using R-style formulas and pandas DataFrames.
It is often necessary to assign a series of discrete values to continuosly variable data sequenced by time, position, etc., thereby parsing the data into fewer and larger segments of variable width. The 'segment' utility takes an input data stream as a Hidden Markov Model and applies the Viterbi algorithm to find the most likely segmentation path through the data.
This project (CvHMM) is an implementation of discrete Hidden Markov Models (HMM) based on OpenCV. It is simple to understand and simple to use. The Zip file contains one header for the implementation and one main.cpp file for a demonstration of how it works. Hope it becomes useful for your projects.