Skip to content

v0.3.0

Choose a tag to compare

@misterekkk misterekkk released this 27 Oct 02:38
· 57 commits to main since this release

lignum 0.3.0 adds CatBoost and moves to the Apache License 2.0.

pip install --upgrade pylignum   # imported as `import lignum`

Highlights

  • CatBoost models, bit-identical to CatBoost. Symmetric trees, float features, categorical features as one-hot or CTRs (Borders, Buckets, Counter, BinarizedTargetMeanValue) including combinations of categories; binary, regression, Poisson, Tweedie, MultiClass and MultiClassOneVsAll. Reads .cbm and JSON.
  • Categories straight from your data: strings or integers from pandas, numpy object arrays, lists, pyarrow and polars. C and C++ callers pass category hashes (LignumCatBoostHash), or Arrow batches that lignum hashes itself.
  • Fast: a dedicated kernel for symmetric trees, built for both generic x86-64 and AVX2 (chosen at run time), on Linux, macOS and Windows.

Performance

CatBoost 1.2.10 / lignum, 500 trees of depth 6, C API, one thread:

x86-64 (AMD EPYC 9V45) ARM (Neoverse-N2)
Adult (categorical) 0.424 / 0.213 s 0.941 / 0.339 s
Diabetes 130-US (categorical) 1.624 / 0.735 s 2.926 / 1.209 s
Covertype (numeric) 0.287 / 0.119 s 0.818 / 0.265 s
One row, Adult 20.1 / 2.3 µs 50.7 / 4.9 µs

2-3x faster than CatBoost on batches and 7-14x on single rows. The smallest margin is on purely numeric models on x86 (California housing: 0.071 vs 0.061 s). Full results, including Apple M4, Windows and synthetic data: https://misterekkk.github.io/lignum/benchmarks/

Changed

  • License: Apache License 2.0. Versions up to 0.2.0 remain available under the MIT License.
  • The .bin format is now version 0.7. Files written by 0.2.0 are rejected with a clear error: export them again from the original model.
  • A 1-D array or flat list is one row for every model.

Fixed

  • predict accepts read-only arrays (pandas 3.1).

Not supported yet

CatBoost Depthwise / Lossguide trees and text or embedding features are rejected at load time.

Also new: a changelog, a security policy and a contributing guide. Using lignum? Add yourself to ADOPTERS.md.

Documentation: https://misterekkk.github.io/lignum/