Skip to main content

hiddenmarkov

PyPI

A simple Python library for Hidden Markov Models.

This library was created for educational purposes and does not aim to have the most efficient implementation.

Setup

Simple installation

pip install python-hiddenmarkov

Develop version

git clone https://github.com/neosatrapahereje/hiddenmarkov.git
cd hiddenmarkov
pip install -e .

Usage

Example from Wikipedia

import numpy as np
from hiddenmarkov import CategoricalObservationModel, ConstantTransitionModel, HMM

obs = ("normal", "cold", "dizzy")
observations = ("normal", "cold", "dizzy")
states = ("Healthy", "Fever")
observation_probabilities = np.array([[0.5, 0.1], [0.4, 0.3], [0.1, 0.6]])
transition_probabilities = np.array([[0.7, 0.3], [0.4, 0.6]])

observation_model = CategoricalObservationModel(
	observation_probabilities, obs
)

init_distribution = np.array([0.6, 0.4])

transition_model = ConstantTransitionModel(
	transition_probabilities, init_distribution
)

hmm = HMM(observation_model, transition_model, state_space=states)

path, prob = hmm.find_best_sequence(observations, log_probabilities=False)
print("Example Wikipedia")
print("Best sequence", path)
print("Expected Sequence", ["Healthy", "Healthy", "Fever"])
print("Sequence probability", prob)
print("Expected probability", 0.01512)

Licence

The code in this package is licensed under the MIT Licence. For details, please see the LICENSE file.

Metadata

Release files for python-hiddenmarkov 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-hiddenmarkov 0.1.4
File Size Uploaded Provenance Actions
python_hiddenmarkov-0.1.4.tar.gz 10.2 kB With provenance Details for python_hiddenmarkov-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-hiddenmarkov 0.1.4
File Interpreter ABI Platform Actions
python_hiddenmarkov-0.1.4-py3-none-any.whl Python 3 none any Details for python_hiddenmarkov-0.1.4-py3-none-any.whl

Total release size: 18.9 kB

Release files / python_hiddenmarkov-0.1.4.tar.gz

Download URL python_hiddenmarkov-0.1.4.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c0481c3d51d9feae5bcbf59fa5241a6fb682b19ab0f923e225826e23d3242775
BLAKE2b-256 checksum
How to use checksums
34a01cb23e35b82f2812ef3088359f1cf800c86cc79465930798a8a1d7e3c81b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / python_hiddenmarkov-0.1.4-py3-none-any.whl

Download URL python_hiddenmarkov-0.1.4-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c2ddbd1c1d3751037153d2886d42b43ad094954764fd3a9a0b717d509044dd2
BLAKE2b-256 checksum
How to use checksums
66be70edd6409df9d660ed1c03635f3c537bbc0688a2b914279828e87b63f428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Security for python-hiddenmarkov 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for python_hiddenmarkov-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page