中文版本的 README
FastHMM
A python package for HMM (Hidden Markov Model) model with fast train and decoding implementation
Python version
test by using Python3
Install
pip
pip install FastHMM
source
pip install git+https://github.com/312shan/FastHMM.git
Usage
from FastHMM.hmm import HMMModel
# test model training and predict
hmm_model = HMMModel()
hmm_model.train_one_line([("我", "r"), ("爱", "v"), ("北京", "ns"), ("天安门", "ns")])
hmm_model.train_one_line([("你", "r"), ("去", "v"), ("深圳", "ns")])
result = hmm_model.predict(["俺", "爱", "广州"])
print(result)
# test save and load model
hmm_model.save_model()
hmm_model = HMMModel().load_model()
result = hmm_model.predict(["我们", "爱", "深圳"])
print(result)
Output:
[('俺', 'r'), ('爱', 'v'), ('广州', 'ns')]
[('我们', 'r'), ('爱', 'v'), ('深圳', 'ns')]
Performance:
test on dataset 人民日报
python .test/test_postagging.py
Output:
train size 18484 ,test_size 1000
finish training
eval result:
predict 57929 tags, 54228 correct, accuracy 0.9361114467710473
runtime : 370.1029086 seconds
Most of time the consuming is on the decoding stage, I tried many ways to implement viterbi algorithm, The implementation I currently use is the fastest If you have suggestions for improving this decoding algorithm, please let me know, thank you very much.
Reference
Metadata
Release files for FastHMM 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| FastHMM-0.1.2.tar.gz | 5.8 kB | Without provenance | Details for FastHMM-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| FastHMM-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for FastHMM-0.1.2-py3-none-any.whl |
Total release size: 12.6 kB
Release files / FastHMM-0.1.2.tar.gz
| Download URL | FastHMM-0.1.2.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
157856e9e7505a2a9f7e1d1ea59cb6ed8696be25d7160e3a8abf9cdc512c0353
|
|
BLAKE2b-256 checksum How to use checksums |
fc7ba179d1aed2d46c24a727909ad3f05651d2732de5487986979fdcce5ee1ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Release files / FastHMM-0.1.2-py3-none-any.whl
| Download URL | FastHMM-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
360c01d063f0340b7cb56df7f0cc3a91a17017913c445a6207d8d670ae15b361
|
|
BLAKE2b-256 checksum How to use checksums |
972cdcb2b902cb4e3856416aa2a841a7ba7e01148edd9978b9447b40c2dacb5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Security for FastHMM 0.1.2
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.