Skip to main content

ebm-rs for Python

Fast inference for InterpretML Explainable Boosting Machines, written in Rust. Train with interpret, then score with ebm_rs. Results match interpret's to floating-point rounding.

pip install ebm-rs

Getting a model

From a JSON file. Save the model where you train, load it where you predict. interpret doesn't need to be installed where you predict.

# Where you train
fitted_ebm.to_json("model.json", detail="minimal")
# Where you predict
from ebm_rs import Ebm

model = Ebm.load("model.json")

From a fitted interpret model, in memory. No file, when both run in the same process:

from ebm_rs import Ebm

model = Ebm.from_interpret(fitted_ebm)

Ebm.from_json(text) loads the same JSON from a string, for example one read from a database or object store. detail="minimal" gives the smallest file; to_json()'s other detail levels load too.

Predicting

# Batches: pandas, polars, pyarrow, numpy, or a dict of columns
proba = model.predict_proba(df)  # (n, n_classes)
labels = model.predict(df)
scores = model.decision_function(df)
terms = model.explain(df)  # per-term contributions, like interpret's eval_terms

# One row: a dict keyed by feature name, or a list in feature order
model.predict_proba_one({"age": 42, "color": "blue", "visits": 3})
model.explain_one([42, "blue", 3])  # {"age": ..., "color": ..., "age & color": ...}

Inputs

input columns matched notes
pandas DataFrame by name numeric, nullable (Int64, Float64), category, string and object columns
polars DataFrame by name including Categorical and Enum; call .collect() on a LazyFrame first
pyarrow Table / RecordBatch, DuckDB results, anything with __arrow_c_stream__ by name read without copying
numpy 2-D array or list of rows by position, in model.feature_names order typed arrays are fastest; lists and object arrays are read value by value, like single rows
dict of 1-D arrays by name

Extra columns are ignored. Missing values can be None, NaN, pd.NA or nulls.

Integers stay exact (Python and numpy ints, and integer columns of every input type), so on a categorical feature an ID-like code such as 12345678901234567 finds its category the way it does in interpret, even past the range where floats are exact.

Known differences with interpret

ebm-rs reads each value the same way whatever the other rows hold. interpret doesn't quite: in a continuous column of a numpy object array that also contains text, it converts every value to text first, so True becomes "True" (unknown bin, instead of 1) and np.float32(0.1) becomes "0.1" (instead of its exact value). ebm-rs reads them as 1 and as the exact value. Likewise on a categorical feature, interpret reads a bool as the category "1"/"0", except when every other value in the column is text, bytes or an int, where it reads "True"/"False"; ebm-rs always reads "1"/"0". Lists, tuples, dicts and sets are refused as values for any feature; interpret refuses them on categorical features and scores them as unknown on continuous ones.

Speed

Batch methods release the GIL. With parallel=True (the default) they use every core for batches large enough to gain; pass parallel=False to stay on one thread.

Measured on an Apple M5 against interpret 0.7.8 (see BENCHMARKS.md in the repository):

  • One row: predict_proba_one takes 0.5–1.5 µs, 195–290× faster than interpret's predict_proba on a 1-row DataFrame.
  • 100,000 rows on all cores: 2.7–10.5× faster than interpret, depending on the model and the input type.

Use the *_one methods for single rows. Passing a 1-row DataFrame works, but pandas overhead then dominates, and it's only about 1.6× faster than interpret.

Building from source

Building needs a Rust toolchain and maturin. From the repository root:

pip install maturin
maturin develop --release -m python/Cargo.toml
pip install --group python/pyproject.toml:test && pytest python/tests

Code quality and security checks

CI runs these on every push. Run them from the repository root:

pip install --group python/pyproject.toml:dev  # needs pip 25.1+
ruff check . && ruff format --check .
cd python && mypy
cargo audit
pip-audit ./python && pip-audit
  • pip-audit checks the package's runtime dependencies (./python), then everything installed in your environment, including the dev group.
  • mypy runs in strict mode on the package, with relaxed settings for the tests.
  • cargo audit fails on any known vulnerability in a Rust dependency. "Unmaintained" notices are only reported: chrono and chrono-tz, which arrive through Arrow, are currently flagged as unmaintained, with no vulnerability and no replacement available.
  • The Security audit workflow also runs weekly, to catch new advisories against dependencies that haven't changed.

The package needs Python 3.10 or newer. One wheel per platform covers every Python version from 3.10 up.

License

MIT. ebm-rs is an independent project, not affiliated with or endorsed by Microsoft or the InterpretML project.

Metadata

Release files for ebm-rs 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ebm-rs 0.2.4
File Size Uploaded Provenance Actions
ebm_rs-0.2.4.tar.gz 889.7 kB With provenance Details for ebm_rs-0.2.4.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for ebm-rs 0.2.4
File Actions
ebm_rs-0.2.4-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for ebm_rs-0.2.4-cp310-abi3-win_amd64.whl
ebm_rs-0.2.4-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for ebm_rs-0.2.4-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
ebm_rs-0.2.4-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for ebm_rs-0.2.4-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
ebm_rs-0.2.4-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for ebm_rs-0.2.4-cp310-abi3-macosx_11_0_arm64.whl
ebm_rs-0.2.4-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for ebm_rs-0.2.4-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 15.4 MB

Release files / ebm_rs-0.2.4.tar.gz

Download URL ebm_rs-0.2.4.tar.gz
Size 889.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4bedc8346cf1fc2d069aa74acef816186d70c1dd3c12fba1e733cd2fcaf7e475
BLAKE2b-256 checksum
How to use checksums
e101046e70fd94548076afb519492eef5513130aa4f246cc454f9123c3a2de42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ebm_rs-0.2.4-cp310-abi3-win_amd64.whl

Download URL ebm_rs-0.2.4-cp310-abi3-win_amd64.whl
Size 3.1 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
d1a944c5d0c960da42b3497520da03d198deb6c471966cd462d654321eb471fa
BLAKE2b-256 checksum
How to use checksums
6d7be190a74687c9afdbb9c92ec79cf3159c91f1b7ae30004103993a4b56b1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ebm_rs-0.2.4-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL ebm_rs-0.2.4-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 3.1 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
fa3f92c12569df317aad550dbbe091b4508c2ab0a33bf776b76a8fb065cff610
BLAKE2b-256 checksum
How to use checksums
aba6f70d846202104907d8b3fe6d2fdc5fb6f944c51a8fd4fa62b73526ca8491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ebm_rs-0.2.4-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL ebm_rs-0.2.4-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.8 MB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a3d24babe5c84362e9d3673855a5f95e02b01a167e29ef312d51e6194811b34b
BLAKE2b-256 checksum
How to use checksums
a46bdffdf24dc7a04443435bf0c26f747636d4150c7d39b2228cb8f266d2a0c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ebm_rs-0.2.4-cp310-abi3-macosx_11_0_arm64.whl

Download URL ebm_rs-0.2.4-cp310-abi3-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2cf14ecb3855a73bd84d2dc0740ccb733b073772380d70d6cbab8cd96f5aefe8
BLAKE2b-256 checksum
How to use checksums
66dbd78bfb3574a16550d8aed83df1cd9b1ff7c152ec5ed393583bc28efc2e1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ebm_rs-0.2.4-cp310-abi3-macosx_10_12_x86_64.whl

Download URL ebm_rs-0.2.4-cp310-abi3-macosx_10_12_x86_64.whl
Size 2.9 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0affa6b50b79c25ddb2f5856f6472039fef90e612496440fac49412078c1a3aa
BLAKE2b-256 checksum
How to use checksums
72f87819dd1189bcbfd9de00330f2485ce8fb3be697ba103364ef64e79820668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for ebm-rs 0.2.4

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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for ebm_rs-0.2.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page