Skip to main content

A fast Python implementation of HMM

Installation

To install:

$ pip install hmm-tool

Quickstart

from hmmtool import HMM
import numpy as np

### 3 states, 6 observations:
### states values:0/1/2, observations values:0/1/2/3/4/5
hmm = HMM(3,6)

#train
s1 = np.random.randint(6,size = 60)
s2 = np.random.randint(6,size = 40)
hmm.add_data([s1,s2])
hmm.train(maxStep=50,delta=0.001)

#get params
print(hmm.pi)
print(hmm.A)
print(hmm.B)

#predict
#random data
s3 = np.random.randint(6,size = 10)
s4 = np.random.randint(6,size = 10)

#multi inputs:[[o1,o2,o3,...,ot1],[o1,o2,o3,...,ot2]]
#output: [prob1, prob2]
print(hmm.estimate_prob([s3,s4]))
#output: [(prob1, [s1,s2,s3,...,st1]), (prob2, [s1,s2,s3,...,st2])]
print(hmm.decode([s3,s4]))

Metadata

Release files for hmm-tool 0.0.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 hmm-tool 0.0.4
File Size Uploaded Provenance
hmm-tool-0.0.4.tar.gz 4.8 kB Without provenance Details

Release files / hmm-tool-0.0.4.tar.gz

Download URL hmm-tool-0.0.4.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
23cef7036b7bbebdda7f800f564b92cd17fcef8e410c841ab17a7e8b6783fc5a
BLAKE2b-256 checksum
How to use checksums
d766c0644d1899beb58b3fd26d475f9ce741b79591251d4fa22ca633d6e9707d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for hmm-tool 0.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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