Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

ONNX model for FastLinearClassifier predictions are 1 based vs 0 based #431

Closed
dotnet/machinelearning
#4841
@ganik

Description

@ganik

Repro
`
from nimbusml.datasets import get_dataset
from nimbusml.linear_model import FastLinearClassifier
from nimbusml.preprocessing import OnnxRunner

iris_df = get_dataset("iris").as_df()
iris_df.drop(['Species'], axis=1, inplace=True)
iris_no_label_df = iris_df.drop(['Label'], axis=1)
iris_binary_df = iris_no_label_df.rename(columns={'Setosa': 'Label'})

predictor = FastLinearClassifier()
predictor.fit(iris_binary_df)
print(predictor.predict(iris_binary_df))
predictor.export_to_onnx("test.onnx", 'com.microsoft.ml')
onnxrunner = OnnxRunner(model_file="test.onnx")
print(onnxrunner.fit_transform(iris_binary_df))
`
Elapsed time: 00:00:00.9034678
0 1.0
1 1.0
2 1.0
3 1.0
4 1.0
...
145 0.0
146 0.0
147 0.0
148 0.0
149 0.0
Name: PredictedLabel, Length: 150, dtype: float64
Sepal_Length Sepal_Width Petal_Length ... PredictedLabel.onnx.0 Score.onnx.0 Score.onnx.1
0 5.1 3.5 1.4 ... 2.0 0.302603 0.697397
1 4.9 3.0 1.4 ... 2.0 0.333512 0.666488
2 4.7 3.2 1.3 ... 2.0 0.310926 0.689074
3 4.6 3.1 1.5 ... 2.0 0.331948 0.668052
4 5.0 3.6 1.4 ... 2.0 0.295445 0.704555
.. ... ... ... ... ... ... ...
145 6.7 3.0 5.2 ... 1.0 0.953864 0.046136
146 6.3 2.5 5.0 ... 1.0 0.934170 0.065830
147 6.5 3.0 5.2 ... 1.0 0.936460 0.063540
148 6.2 3.4 5.4 ... 1.0 0.950669 0.049331
149 5.9 3.0 5.1 ... 1.0 0.917651 0.082349

[150 rows x 25 columns]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions