Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #234, add converter for IsolationForest #492

Merged
merged 21 commits into from
Aug 22, 2020
Merged

Fixes #234, add converter for IsolationForest #492

merged 21 commits into from
Aug 22, 2020

Conversation

xadupre
Copy link
Collaborator

@xadupre xadupre commented Jun 17, 2020

No description provided.

@lgtm-com
Copy link

lgtm-com bot commented Jun 17, 2020

This pull request introduces 2 alerts when merging 5799d65 into 2bd006e - view on LGTM.com

new alerts:

  • 2 for Unused import

@xadupre xadupre changed the title [WIP] Fixes #234, add converter for IsolationForest Fixes #234, add converter for IsolationForest Jun 19, 2020
@m3at
Copy link

m3at commented Aug 20, 2020

@xadupre thank you for working on this. I tried your branch, but I cannot run the created model with onnxruntime, am I missing something?

Here is a snippet adapted from your test:

import numpy as np
import onnxruntime as rt
from sklearn.ensemble import IsolationForest
from skl2onnx import to_onnx

data = np.random.randn(100, 4).astype(np.float32)
model = IsolationForest(n_estimators=2, random_state=0).fit(data)

# No issue to create the model
model_onnx = to_onnx(model, data)

with open("/tmp/model.onnx", "wb") as f:
    f.write(model_onnx.SerializeToString())

# NotImplemented error
sess = rt.InferenceSession("/tmp/model.onnx")

Which raise

NotImplemented: [ONNXRuntimeError] : 9 : NOT_IMPLEMENTED : Could not find an implementation for the node path_length0_LabelEncoder:LabelEncoder(2)

Which itself point to an issue coming from around here.

Any clue?

@xadupre
Copy link
Collaborator Author

xadupre commented Aug 20, 2020

Which version of onnxruntime are you using?

@m3at
Copy link

m3at commented Aug 20, 2020

The latest version, 1.4 (installed with pip)

@xadupre
Copy link
Collaborator Author

xadupre commented Aug 20, 2020

onnxruntime does not implement parameter keys_floats of LabelEncoder. I used keys_int64s instead but it adds a cast to the graph. It should fix your issue.

@m3at
Copy link

m3at commented Aug 21, 2020

It does indeed. Thank you for the quick fix 👍

@xadupre xadupre merged commit 875789b into onnx:master Aug 22, 2020
@xadupre xadupre deleted the i234if branch September 30, 2020 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants