Ebm2onnx
Ebm2onnx converts EBM models to ONNX. It allows to run an EBM model on any ONNX compliant runtime.
Features
Binary classification
Regression
Continuous, nominal, and ordinal variables
N-way interactions
Multi-class classification (support is still experimental in EBM)
Expose predictions probabilities
Expose local explanations
Export a model as part of a scikit-learn pipeline (experimental)
The export of the models is tested against ONNX Runtime.
Get Started
Train an EBM model:
# prepare dataset
df = pd.read_csv('titanic_train.csv')
df = df.dropna()
feature_columns = ['Age', 'Fare', 'Pclass', 'Embarked']
label_column = "Survived"
y = df[[label_column]]
le = LabelEncoder()
y_enc = le.fit_transform(y)
x = df[feature_columns]
x_train, x_test, y_train, y_test = train_test_split(x, y_enc)
# train an EBM model
model = ExplainableBoostingClassifier(
feature_types=['continuous', 'continuous', 'continuous', 'nominal'],
)
model.fit(x_train, y_train)
Then you can convert it to ONNX in a single function call:
import onnx
import ebm2onnx
onnx_model = ebm2onnx.to_onnx(
model,
ebm2onnx.get_dtype_from_pandas(x_train),
)
onnx.save_model(onnx_model, 'ebm_model.onnx')
If your dataset is not a pandas dataframe, you can provide the features’ types directly:
import ebm2onnx
onnx_model = ebm2onnx.to_onnx(
model,
dtype={
'Age': 'double',
'Fare': 'double',
'Pclass': 'int',
'Embarked': 'str',
}
)
onnx.save_model(onnx_model, 'ebm_model.onnx')
Try it live
You can live test the model conversion.
You can live test local explanations.
You can live test the export of a scikit-learn pipeline.
Supporting organizations
The following organizations are supporting Ebm2onnx:
SoftAtHome: Main supporter of Ebm2onnx development.
InterpretML: Ebm2onnx is hosted under the umbrella of the InterpretML organization.
Metadata
Release files for ebm2onnx 3.3.1
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 | |
|---|---|---|---|---|
| ebm2onnx-3.3.1.tar.gz | 20.1 kB | Without provenance | Details |
Release files / ebm2onnx-3.3.1.tar.gz
| Download URL | ebm2onnx-3.3.1.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3698a7e2e05fb0402922690fa958fe55264d1d63f8805ed75fa10ae28a9fa2fe
|
|
BLAKE2b-256 checksum How to use checksums |
42844e1f02aa7710c51d81d2782a1f1300212ab8339e67c7b8c7b05425b09a66
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.12
|
Security for ebm2onnx 3.3.1
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.