You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
after fit on a ElasticNet on a regression, convert onnx, based on test_x, default parameters, fail to convert_operators @ iteration 1 - n_vars=0 n_ops=1, for operator SklearnLinearRegressor : at most 1 input(s) is(are) supported but we got 12 input(s). Search issue "LinearRegressor" did not help
expected results
I expect to convert the model to use on onnx_engine. Maybe there is a mistake in the train or the convert, the code is naive.
data
from kaggle: the wine-quality-dataset, tabular data, 12 input variables (float, based on physicochemical tests), one Output variable (based on sensory data): the quality (score between 0 and 10 with 2 decimals).
code
import warnings
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import ElasticNet
warnings.filterwarnings("ignore")
np.random.seed(40)
# Read the wine-quality csv file (make sure you're running this from the root of MLflow!)
data = pd.read_csv("WineQT.csv"))
# Split the data into training and test sets. (0.75, 0.25) split.
train, test = train_test_split(data)
# The predicted column is "quality" which is a scalar from [3, 9]
train_x = train.drop(["quality"], axis=1)
test_x = test.drop(["quality"], axis=1)
train_y = train[["quality"]]
test_y = test[["quality"]]
lr = ElasticNet(alpha=0.2, l1_ratio=0.2, random_state=42)
lr.fit(train_x, train_y)
import skl2onnx
try:
print('--- convert onnx, based on test_x, default parameters ---')
onx = skl2onnx.to_onnx(lr, test_x, model_optim=True, verbose=3) # optional parameters TBD
with open("D00_DATA\D03_MODEL\model.onnx", "wb") as f:
f.write(onx.SerializeToString())
except Exception as exc: # Error to_onnx or IO
print(exc)
Summary
after fit on a ElasticNet on a regression, convert onnx, based on test_x, default parameters, fail to convert_operators @ iteration 1 - n_vars=0 n_ops=1, for operator SklearnLinearRegressor : at most 1 input(s) is(are) supported but we got 12 input(s). Search issue "LinearRegressor" did not help
expected results
I expect to convert the model to use on onnx_engine. Maybe there is a mistake in the train or the convert, the code is naive.
data
from kaggle: the wine-quality-dataset, tabular data, 12 input variables (float, based on physicochemical tests), one Output variable (based on sensory data): the quality (score between 0 and 10 with 2 decimals).
code
log verbose=3
The text was updated successfully, but these errors were encountered: