skillfed

hmmlearn

Hidden Markov Models in Python with scikit-learn like API

hmmlearn v0.3.3 1.3M downloads/30d#4,129 on PyPI3,413
Permissive license DORMANT released

What it is and what it does

hmmlearn provides a suite of algorithms for training and using Hidden Markov Models without labeled data. It wraps the mathematical machinery of HMM inference—forward-backward algorithms, Viterbi decoding, and parameter estimation—behind a scikit-learn-style interface, so if you've used scikit-learn's fit/predict pattern, the API will feel familiar. The package depends on numpy, scikit-learn, and scipy for its numerical and statistical foundations.

Typical use involves fitting an HMM to sequence data (like time series or biological sequences) to learn the underlying state structure, then using that model to decode hidden states or generate predictions. It's built for research and production work on sequence modeling tasks where you don't have ground-truth labels for the states themselves.

Use it for:

  • Train HMM models on unlabeled time-series data to discover hidden state patterns in sensor readings or financial data.
  • Decode the most likely sequence of hidden states given observed data using Viterbi algorithm.
  • Model biological sequences (DNA, protein) where true state labels are unknown but state transitions follow Markovian structure.
  • Estimate transition and emission probabilities from sequence data for downstream inference tasks.
  • Prototype sequence modeling experiments before moving to more complex approaches.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

hmmlearn implements unsupervised learning and inference algorithms for Hidden Markov Models with a scikit-learn compatible API.

Yes, if you need unsupervised HMM modeling and can accept dormant maintenance. The package is stable, has no known vulnerabilities, and the scikit-learn API integration is well-established. Install friction is moderate (C compiler required) but manageable. Best suited for research, prototyping, or production systems where HMM is the right model and you don't expect active feature development.

Install

hmmlearn on PyPI

pip

pip install hmmlearn

uv

uv add hmmlearn

poetry

poetry add hmmlearn

Installing hmmlearn

Before you install

Medium install friction due to C compiler requirement. Package is in dormant maintenance status with last release 652 days ago, though the repository remains active and the codebase is stable.

License in practice

BSD permissive license allows commercial and private use with minimal restrictions.

Quickstart

pip install hmmlearn

import numpy as np
from hmmlearn import hmm

model = hmm.GaussianHMM(n_components=3)
model.fit(X)
hidden_states = model.predict(X)

Requires a C compiler and Python development headers to build from source; prebuilt wheels are available for Python 3.10–3.13 on common platforms.

Verify before relying

  • Whether the 652-day gap since last release reflects active maintenance or abandonment risk
  • Current state of C compiler compatibility across modern build environments
  • Whether scipy is a runtime dependency (listed as runtime but not explicitly documented)

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.8)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — numpy, scikit-learn, scipy
Maintenance dormant — 652 days since the last release
Last repo commit
First released
Downloads 1,269,719/month — #4,129 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hmmlearn-0.3.3-cp310-cp310-macosx_10_9_universal2.whl; hmmlearn-0.3.3-cp310-cp310-macosx_10_9_x86_64.whl; hmmlearn-0.3.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hmmlearn-0.3.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hmmlearn-0.3.3-cp310-cp310-win_amd64.whl; hmmlearn-0.3.3-cp311-cp311-macosx_10_9_universal2.whl; hmmlearn-0.3.3-cp311-cp311-macosx_10_9_x86_64.whl; hmmlearn-0.3.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hmmlearn-0.3.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hmmlearn-0.3.3-cp311-cp311-win_amd64.whl; hmmlearn-0.3.3-cp312-cp312-macosx_10_9_universal2.whl; hmmlearn-0.3.3-cp312-cp312-macosx_10_9_x86_64.whl; hmmlearn-0.3.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hmmlearn-0.3.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hmmlearn-0.3.3-cp312-cp312-win_amd64.whl; hmmlearn-0.3.3-cp313-cp313-macosx_10_13_universal2.whl; hmmlearn-0.3.3-cp313-cp313-macosx_10_13_x86_64.whl; hmmlearn-0.3.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; hmmlearn-0.3.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; hmmlearn-0.3.3-cp313-cp313-win_amd64.whl

Development Status :: 3 - AlphaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Scientific/EngineeringTopic :: Software Development

Tags

hidden markov models pythonhmm unsupervised learningmarkov chain inferencesequence modeling algorithmshmm scikit-learnprobabilistic sequence modelshmm training inference
sequence-modelingunsupervised-learningmarkov-models

More Software Development packages