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

ONNX model of ToKey outputs 1 based key, while 0 based expected #428

Open
ganik opened this issue Feb 11, 2020 · 1 comment
Open

ONNX model of ToKey outputs 1 based key, while 0 based expected #428

ganik opened this issue Feb 11, 2020 · 1 comment

Comments

@ganik
Copy link
Member

ganik commented Feb 11, 2020

Repro
`from nimbusml.datasets import get_dataset
from nimbusml.preprocessing import OnnxRunner, ToKey

iris_df = get_dataset("iris").as_df()
iris_df = iris_df.drop(['Label'], axis=1)

transform = ToKey() << {'NewVals': 'Setosa'}
print(transform.fit_transform(iris_df))
transform.export_to_onnx("test.onnx", 'com.microsoft.ml')
onnx_runner = OnnxRunner(model_file="test.onnx")
print(onnx_runner.fit_transform(iris_df))`

Output:
Sepal_Length Sepal_Width Petal_Length Petal_Width Species Setosa NewVals
0 5.1 3.5 1.4 0.2 setosa 1.0 0
1 4.9 3.0 1.4 0.2 setosa 1.0 0
2 4.7 3.2 1.3 0.2 setosa 1.0 0
3 4.6 3.1 1.5 0.2 setosa 1.0 0
4 5.0 3.6 1.4 0.2 setosa 1.0 0
.. ... ... ... ... ... ... ...
145 6.7 3.0 5.2 2.3 virginica 0.0 1
146 6.3 2.5 5.0 1.9 virginica 0.0 1
147 6.5 3.0 5.2 2.0 virginica 0.0 1
148 6.2 3.4 5.4 2.3 virginica 0.0 1
149 5.9 3.0 5.1 1.8 virginica 0.0 1

[150 rows x 7 columns]
Sepal_Length Sepal_Width Petal_Length ... Species.onnx.0 Setosa.onnx.0 NewVals.onnx.0
0 5.1 3.5 1.4 ... setosa 1.0 1.0
1 4.9 3.0 1.4 ... setosa 1.0 1.0
2 4.7 3.2 1.3 ... setosa 1.0 1.0
3 4.6 3.1 1.5 ... setosa 1.0 1.0
4 5.0 3.6 1.4 ... setosa 1.0 1.0
.. ... ... ... ... ... ... ...
145 6.7 3.0 5.2 ... virginica 0.0 2.0
146 6.3 2.5 5.0 ... virginica 0.0 2.0
147 6.5 3.0 5.2 ... virginica 0.0 2.0
148 6.2 3.4 5.4 ... virginica 0.0 2.0
149 5.9 3.0 5.1 ... virginica 0.0 2.0

[150 rows x 13 columns]

@Lynx1820
Copy link

Update: It was decided that this issue would not be resolved, as Pandas expects 1 based keys.

@Lynx1820 Lynx1820 removed their assignment Oct 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants