Registry / ai-ml / pyhacrf-datamade

pyhacrf-datamade

JSON →
library0.2.8pypypi✓ verified 82d ago

Hidden alignment conditional random field (HACRF) for discriminative string edit distance. Current version 0.2.8, infrequent releases.

pip install pyhacrf-datamade
INSTALL
IMPORT
SIG · PYHACRF-DATAMADE
P
pyhacrf-datamade
ai-mlpythonv0.2.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Hacrf
from pyhacrf import Hacrf
from pyhacrf import HACRF
PairFeatureExtractor
from pyhacrf import PairFeatureExtractor
StringPairFeatureExtractor
from pyhacrf import StringPairFeatureExtractor

Minimal example: train HACRF on string pairs and predict.

from pyhacrf import HACRF import numpy as np # Example strings as lists of characters X = [list('abc'), list('abd'), list('abce')] y = [0, 0, 1] model = HACRF() model.fit(X, y) predictions = model.predict([list('abe')]) print(predictions)
Debug
Known issues
gotchaInput strings must be passed as lists of characters (or tokens), not as raw strings. For example, pass ['a','b','c'] not 'abc'.
fix
Convert strings to list: list('abc')
affects: all
deprecatedThe version 0.2.6 changed the API: previously used 'model.fit(X, y, ...)' now requires explicit 'model.fit(X, y)'. Some older examples show deprecated arguments like 'verbose'.
fix
Remove deprecated arguments; update to current fit signature.
affects: <0.2.6
gotchaThe HACRF model expects X to be a list of string pairs? Actually, the input X is a list of strings (each string to align). For pairwise alignment, you need to construct paired examples yourself.
fix
For pairwise edit distance, pass two lists: X = list(zip(strings1, strings2)), then model.fit(X, y). But ensure each element is a list of characters.
affects: all
breakingWhen upgrading from 0.2.4 to 0.2.6, the internal Cython alignment structure changed; models saved with older versions may not load.
fix
Retrain models after upgrading.
affects: <0.2.6
Upgrade
Version history
0.2.8latest on PyPI · released Jun 20, 2024
Audit
Dependencies
numpyrequiredCore dependency for array operations
scipyrequiredUsed for optimization (L-BFGS-B)
sklearnoptionalOptional for metrics and cross-validation
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
pyhacrf-datamade — pip install pyhacrf-datamade · libregistry