Skip to main content

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

Project description


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

The EM algorithm is based on Yu (2010) (Section 3.1), 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.1.tar.gz (127.5 kB view hashes)

Uploaded source

Built Distributions

edhsmm-0.2.1-py3.10-win-amd64.egg (91.0 kB view hashes)

Uploaded 0 2 1

edhsmm-0.2.1-cp310-cp310-win_amd64.whl (82.6 kB view hashes)

Uploaded cp310

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page