Using Hummingbird
Usage
# Disable Hummingbird warnings for pytest.
import warnings
warnings.filterwarnings("ignore")
from hummingbird.ml import convertfrom sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
# Instantiate the logistic regression from sklearn
lr = LogisticRegression()
# Create synthetic data
X, y = make_classification(
n_samples=100, n_features=20, n_classes=2
)
# Fit the model
lr.fit(X, y)
# Convert the model to ONNX
onnx_model = convert(lr, backend="onnx", test_input=X).modelLast updated
Was this helpful?