{"id":27278,"library":"pyhacrf-datamade","title":"pyhacrf-datamade","description":"Hidden alignment conditional random field (HACRF) for discriminative string edit distance. Current version 0.2.8, infrequent releases.","status":"active","version":"0.2.8","language":"python","source_language":"en","source_url":"https://github.com/datamade/pyhacrf","tags":["conditional random field","edit distance","string alignment","discriminative"],"install":[{"cmd":"pip install pyhacrf-datamade","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency for array operations","package":"numpy","optional":false},{"reason":"Used for optimization (L-BFGS-B)","package":"scipy","optional":false},{"reason":"Optional for metrics and cross-validation","package":"sklearn","optional":true}],"imports":[{"note":"Incorrect submodule path; library uses a simple top-level import.","wrong":"from pyhacrf.hacrf import HACRF","symbol":"HACRF","correct":"from pyhacrf import HACRF"}],"quickstart":{"code":"from pyhacrf import HACRF\nimport numpy as np\n\n# Example strings as lists of characters\nX = [list('abc'), list('abd'), list('abce')]\ny = [0, 0, 1]\n\nmodel = HACRF()\nmodel.fit(X, y)\npredictions = model.predict([list('abe')])\nprint(predictions)","lang":"python","description":"Minimal example: train HACRF on string pairs and predict."},"warnings":[{"fix":"Convert strings to list: list('abc')","message":"Input strings must be passed as lists of characters (or tokens), not as raw strings. For example, pass ['a','b','c'] not 'abc'.","severity":"gotcha","affected_versions":"all"},{"fix":"Remove deprecated arguments; update to current fit signature.","message":"The 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'.","severity":"deprecated","affected_versions":"<0.2.6"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Retrain models after upgrading.","message":"When upgrading from 0.2.4 to 0.2.6, the internal Cython alignment structure changed; models saved with older versions may not load.","severity":"breaking","affected_versions":"<0.2.6"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Explicitly cast arrays: np.array(arr, dtype=np.int64)","cause":"Incompatible numpy dtype on Windows (int32 default) vs Cython expecting int64.","error":"ValueError: Buffer dtype mismatch, expected 'int64' but got 'int32'"},{"fix":"Use model.decision_function(X) instead of model.scores_","cause":"The 'scores_' attribute was renamed to 'decision_function' in version 0.2.6.","error":"AttributeError: 'HACRF' object has no attribute 'scores_'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}