Skip to main content

An(other) implementation of Explicit Duration Hidden Semi-Markov Models in Python 3

Project description

Warning: I made this repo when I was an undergrad, but was not even part of my undergrad project. Correctness of implementation not guaranteed, so use at your own risk.


An(other) implementation of Explicit Duration Hidden Semi-Markov Models in Python 3

The EM algorithm is based on Yu (2010) (Section 3.1, 2.2.1 & 2.2.2), while the Viterbi algorithm is based on Benouareth et al. (2008).

The code style is inspired from hmmlearn and jvkersch/hsmmlearn.

Implemented so far

  • EM algorithm
  • Scoring (log-likelihood of observation under the model)
  • Viterbi algorithm
  • Generate samples
  • Support for multivariate Gaussian emissions
  • Support for multiple observation sequences
  • Support for multinomial (discrete) emissions


  • python >= 3.5
  • numpy >= 1.17
  • scikit-learn >= 0.16
  • scipy >= 0.19

Installation & Tutorial

Via pip:

pip install edhsmm


python install

Test in venv (Windows):

python -m venv venv
pip install --upgrade -r requirements.txt
python install

Note: Also run pip install notebook matplotlib to run the notebooks.

For tutorial, see the notebooks. This also serves as some sort of "documentation".

Found a bug? Suggest a feature? Please post on issues.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

edhsmm-0.2.2.tar.gz (128.9 kB view hashes)

Uploaded source

Built Distribution

edhsmm-0.2.2-cp310-cp310-win_amd64.whl (84.0 kB view hashes)

Uploaded cp310

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page