EBM model serialization to ONNX
Project description
Ebm2onnx
Ebm2onnx is an EBM model serialization to ONNX. It allows to run an EBM model on any ONNX compliant runtime.
Features
Binary classification
Regression
Continuous variables
Categorical variables
Interactions
Multi-class classification (support is still experimental in EBM)
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','categorical'],
)
model.fit(x_train, y_train)
Then you can convert it to ONNX in a single function call:
import ebm2onnx
onnx_model = ebm2onnx.to_onnx(
model,
dtype={
'Age': 'double',
'Fare': 'double',
'Pclass': 'int',
}
)
onnx.save_model(onnx_model, 'ebm_model.onnx')
History
0.0.0 (2021-03-09)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ebm2onnx-1.0.0.tar.gz
(8.6 kB
view details)
File details
Details for the file ebm2onnx-1.0.0.tar.gz
.
File metadata
- Download URL: ebm2onnx-1.0.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e2f103dc7c77833acb1d8a86efdafddf9eb12b3fa6db8152edcf9b2cb46b99a |
|
MD5 | e4e29f8f03482cc8a352458d67564fb0 |
|
BLAKE2b-256 | 25ac7bec83755c055eb484e4a7381ae2704147dc2bf755a17aea95f1b3fd40f8 |