External libraries
Hummingbird
# 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
model = LogisticRegression()
# Create synthetic data
X, y = make_classification(
n_samples=100, n_features=20, n_classes=2
)
# Fit the model
model.fit(X, y)
# Convert the model to ONNX
onnx_model = convert(model, backend="onnx", test_input=X).modelskorch
Brevitas
Last updated
Was this helpful?