pyhcrf
A hidden (state) conditional random field (HCRF) written in Python and Cython.
This package is a fork of the original pyhcrf, written by
Dirko Coetsee, featuring Python 3 and Windows support
with a cleaner code base maintained by Martin Larralde.
Overview
pyhcrf implements a HCRF model with a sklearn-inspired
interface. The model classifies sequences according to a latent state sequence.
This package provides methods to learn parameters from example sequences and to
classify new sequences. See the paper
by Wang et al. and the report
by Dirko Coetsee.
States
Each state is numbered 0, 1, ..., num_states - 1. The state machine starts
in state 0 and ends in num_states - 1. Currently the state transitions are
constrained so that, on each element in the input sequence, the state machine
either stays in the current state or advances to a state represented by the
next number. This default can be changed by setting the transitions and
corresponding transition_parameters properties.
Dependencies
pyhcrf depends on numpy, scipy (for the LM-BFGS optimiser and scipy.sparse),
and also needs cython for building from source.
Example
X = [array([[ 1. , -0.82683403, 2.48881337],
[ 1. , -1.07491808, 1.55848197],
[ 1. , 6.7814359 , 4.01074595]]),
array([[ 1. , -3.01165932, -2.15972362],
[ 1. , -3.41449473, -2.2668825 ]]),
array([[ 1. , -2.64921323, -1.20159641],
[ 1. , 0.31139394, 1.58841159]]),
array([[ 1. , 5.85226017, 2.43317499],
[ 1. , -1.57598266, -2.07585778]]),
array([[ 1. , -0.32999744, -2.70695361],
[ 1. , 0.44311988, 0.36400733]]),
array([[ 1. , -0.05301562, 3.95424435],
[ 1. , 3.04540498, -3.25040276]]),
array([[ 1. , -4.29117715, 0.9167861 ],
[ 1. , -3.22775884, 1.83277224]]),
array([[ 1. , -2.80856491, 1.95630489],
[ 1. , 1.62290542, -0.7457237 ]]),
array([[ 1. , -2.32682366, 2.60844469],
[ 1. , 2.12320609, 1.04483217]]),
array([[ 1. , -4.17616178, 4.09969658],
[ 1. , 0.67287935, -5.67652159]])]
y = [0, 1, 0, 1, 1, 0, 1, 0, 0, 0]
>>> from pyhcrf import HCRF
>>> from sklearn.metrics import confusion_matrix
>>> model = HCRF(num_states=3, random_seed=3, optimizer_kwargs={'maxfun':200})
>>> model.fit(X, y)
>>> pred = model.predict(X)
>>> confusion_matrix(y, pred)
array([[12, 0],
[ 0, 8]])
Installation
Download/clone and run
python setup.py build_ext --inplace
python setup.py install
License
The original code, and all contributions made subsequently in this fork, are licensed with BSD-2-Clause.
Metadata
Release files for pyhcrf 0.1.0
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 |
|---|---|---|---|---|
| pyhcrf-0.1.0.tar.gz | 15.2 kB | Without provenance | Details for pyhcrf-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 6.0 MB
Release files / pyhcrf-0.1.0.tar.gz
| Download URL | pyhcrf-0.1.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c0c3eb3782c9d6793b1c102e89d6f901329f279f2a0f48ac5349017793f8347
|
|
BLAKE2b-256 checksum How to use checksums |
01bd60c259d6b39eca6d953bad03febff550fc05d980ed3eaf0acceb842f57da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.2
|
Release files / pyhcrf-0.1.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl
| Download URL | pyhcrf-0.1.0-pp36-pypy36_pp73-manylinux2010_x86_64.whl |
|---|---|
| Size | 113.3 kB |
| Tags | Linux glibc 2.12+ x86-64 PyPy 3.6 PyPy 3.6 7.3 |
|
SHA-256 checksum How to use checksums |
0e77e3adffecb8e34970258649a833ede37088b4549ea30bcd2a90822ceabd5d
|
|
BLAKE2b-256 checksum How to use checksums |
afcf56b2a676f48a9f9cb0fa2892cb6f3bd5f039d9321de2fee2519adfce8cfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.2
|
Release files / pyhcrf-0.1.0-pp36-pypy36_pp73-manylinux1_x86_64.whl
| Download URL | pyhcrf-0.1.0-pp36-pypy36_pp73-manylinux1_x86_64.whl |
|---|---|
| Size | 113.3 kB |
| Tags | Linux glibc 2.5+ x86-64 PyPy 3.6 PyPy 3.6 7.3 |
|
SHA-256 checksum How to use checksums |
4e06a63e9b398165c0dbf50b4d5d8eb8c09e73e7bcfbc534a0946916a6975437
|
|
BLAKE2b-256 checksum How to use checksums |
e7466b1612fc5341ec04fa9a3e67778d4c6136be870f8abc33e20bdf2c81a878
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.2
|
Release files / pyhcrf-0.1.0-cp38-cp38-win_amd64.whl
| Download URL | pyhcrf-0.1.0-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 265.2 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
26b4ebcaf1ffdadb04953dacd0517390e58f9abe7249e642f3c712b726f240b5
|
|
BLAKE2b-256 checksum How to use checksums |
ff931bc256b6c1ac49146ca449f74ef409c260e8595e6a5e208d1800f1f8f966
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.0
|
Release files / pyhcrf-0.1.0-cp38-cp38-manylinux2010_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp38-cp38-manylinux2010_x86_64.whl |
|---|---|
| Size | 573.4 kB |
| Tags | CPython 3.8 Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
09b06bf397451e224e62b7b0451a285f0d14c9406cc22f393ba7d81e5c75ff08
|
|
BLAKE2b-256 checksum How to use checksums |
70d110d0c01ef4c30dc8b56bab448c11caf9c5362f73db5ea7997054ed39662a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
|
Release files / pyhcrf-0.1.0-cp38-cp38-manylinux1_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp38-cp38-manylinux1_x86_64.whl |
|---|---|
| Size | 573.4 kB |
| Tags | CPython 3.8 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
f526d9571c30c18109d4c8f4e32fa09d960e37ffb2f5c407d013a033b988fbfd
|
|
BLAKE2b-256 checksum How to use checksums |
47ccdaf3e3afe292995ec4aa5414c5c8bbbfa3780e709022dc904fcfc0cf98b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
|
Release files / pyhcrf-0.1.0-cp38-cp38-macosx_10_13_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp38-cp38-macosx_10_13_x86_64.whl |
|---|---|
| Size | 118.4 kB |
| Tags | CPython 3.8 macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
3949b399128eab93ae5fae90c786f3dd14a42f022e47cb15428e268cdf54bdb7
|
|
BLAKE2b-256 checksum How to use checksums |
a8ae6880e070a77bbc6e9407200e8a00a6729cdffd6f8b381e1c53528853a878
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3+
|
Release files / pyhcrf-0.1.0-cp37-cp37m-win_amd64.whl
| Download URL | pyhcrf-0.1.0-cp37-cp37m-win_amd64.whl |
|---|---|
| Size | 263.0 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d74f4d450ecadeeb7175f9387c525be074a5ab6690854d484d90a7918587f04b
|
|
BLAKE2b-256 checksum How to use checksums |
adea5ccf688059c5f9d3427d0ed74b3708f5d49104036d018aaabdc655da53f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5
|
Release files / pyhcrf-0.1.0-cp37-cp37m-manylinux2010_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp37-cp37m-manylinux2010_x86_64.whl |
|---|---|
| Size | 509.4 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
915333ae7e5c713fde7c0247fe32c0e5bc52502e50c04dc68713d880d10f2bbe
|
|
BLAKE2b-256 checksum How to use checksums |
e8e8b045a9c89dc57f26f935ccbd4ed5b7d3467d40a3179173659b9b011d56bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
|
Release files / pyhcrf-0.1.0-cp37-cp37m-manylinux1_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp37-cp37m-manylinux1_x86_64.whl |
|---|---|
| Size | 509.4 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
af4865a6e2085bd7acf1683aa6ee41c726b68aa587a726313cfbe6f7cb658e11
|
|
BLAKE2b-256 checksum How to use checksums |
15bcaad97f78939f813fe8e949b1acd498b5315282f1706687090a5af65e84bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
|
Release files / pyhcrf-0.1.0-cp37-cp37m-macosx_10_13_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp37-cp37m-macosx_10_13_x86_64.whl |
|---|---|
| Size | 116.8 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
1cb6eb5c5e6bb5a94b5a9b954eebcff9ac1191b43011781048b9ee723f7a41f9
|
|
BLAKE2b-256 checksum How to use checksums |
443299c48cb064ffef9da4fc3f8b4001833c8b905670fe09ffe7773b23a89150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7+
|
Release files / pyhcrf-0.1.0-cp36-cp36m-win_amd64.whl
| Download URL | pyhcrf-0.1.0-cp36-cp36m-win_amd64.whl |
|---|---|
| Size | 263.0 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b3b23edfa7ffc3fa403fa8b5d1d1e268225abf59b448a75e6663d08150104682
|
|
BLAKE2b-256 checksum How to use checksums |
21cd0e53f15385b3ba199a0dfe66e3fd545c673d39f143cc6c3bb6ba6b6eca9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.8
|
Release files / pyhcrf-0.1.0-cp36-cp36m-manylinux2010_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp36-cp36m-manylinux2010_x86_64.whl |
|---|---|
| Size | 509.7 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7737aa3aa99cf552192ac4c9bbd8adec5fa5734eb7032af3c89dd9c96c8fc317
|
|
BLAKE2b-256 checksum How to use checksums |
1d621becc6ab69399a9b747e74c306ebd47965a2395c8cc44bbb1d34f651f160
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
|
Release files / pyhcrf-0.1.0-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 509.7 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
64a0cf50a3d1cbc89e1af14269b660a81552e4c3e337c54c0aa5c904eb8b96ca
|
|
BLAKE2b-256 checksum How to use checksums |
ada50c7ab214daec4bc7d1a8b227acd760e179f46bad476ea8c6072afab5e53f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10
|
Release files / pyhcrf-0.1.0-cp36-cp36m-macosx_10_13_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp36-cp36m-macosx_10_13_x86_64.whl |
|---|---|
| Size | 118.5 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
5046cb6642494bf46508688a966272257d4ddb0f2dd96bccba03725f64f4eaed
|
|
BLAKE2b-256 checksum How to use checksums |
892ca38229ef308ec01b3ad4bc9eda85158efd1b9e56f2ff1963651fc9ba3c63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.10+
|
Release files / pyhcrf-0.1.0-cp35-cp35m-win_amd64.whl
| Download URL | pyhcrf-0.1.0-cp35-cp35m-win_amd64.whl |
|---|---|
| Size | 261.8 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8bd83e4f0bee26d5fc24a6746290baf1757592ed16e4cfc75faa570b1868f8d3
|
|
BLAKE2b-256 checksum How to use checksums |
fce01f229f0682a7847948de85425b4a4b44357523187b50012a9872ead4f740
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.4
|
Release files / pyhcrf-0.1.0-cp35-cp35m-manylinux2010_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp35-cp35m-manylinux2010_x86_64.whl |
|---|---|
| Size | 504.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
25507ecde74e41c447715b34f0beb3619fae9aff963bf8b00af68b0d6bba3253
|
|
BLAKE2b-256 checksum How to use checksums |
5c08e670525ccfb85a81c52a36798da0d52a95da1ce5c55488eaba4fc1450f73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.7
|
Release files / pyhcrf-0.1.0-cp35-cp35m-manylinux1_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp35-cp35m-manylinux1_x86_64.whl |
|---|---|
| Size | 504.9 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
6666552c267e888e4ec1ac8acbad2f20c4b9e180999a08d8a56516017702faa3
|
|
BLAKE2b-256 checksum How to use checksums |
51414715efab003fb84965cc1a84167212b4c436ba05631688d2e6fc42930ee6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.7
|
Release files / pyhcrf-0.1.0-cp35-cp35m-macosx_10_13_x86_64.whl
| Download URL | pyhcrf-0.1.0-cp35-cp35m-macosx_10_13_x86_64.whl |
|---|---|
| Size | 116.3 kB |
| Tags | CPython 3.5 CPython 3.5 pymalloc macOS 10.13+ x86-64 |
|
SHA-256 checksum How to use checksums |
d6df2c05f9f393970a61d8e39b380ffb7f56145ee186a672befb939dd24ecaaa
|
|
BLAKE2b-256 checksum How to use checksums |
d9fdbbc66ec61418fb43951f994acbd03fb7fb9cb75d401a6e429c1d32d1cf4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.9+
|
Security for pyhcrf 0.1.0
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.