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

RandomForestRegressor converter prediction mismatch with Scikit output #166

Closed
prabhat00155 opened this issue Jun 5, 2019 · 2 comments
Closed
Projects

Comments

@prabhat00155
Copy link
Contributor

prabhat00155 commented Jun 5, 2019

data = load_diabetes()
X = data.data
y = data.target

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
model = RandomForestRegressor().fit(X_train, y_train)

onnx_model = convert_sklearn(model, 'lr', [('input', FloatTensorType(X_test.shape))])
save_model(onnx_model, 'lr.onnx')
sess = InferenceSession('lr.onnx')
res = sess.run(None, input_feed={'input': X_test.astype(np.float32)})

print(np.mean(np.isclose(model.predict(X_test), list(map(lambda x: x[0], res[0])))))

0.9411764705882353

With n_estimators=3 however, prediction matches go upto 0.99.

@xadupre xadupre added this to To do in Mismatches Jul 22, 2019
@xadupre
Copy link
Collaborator

xadupre commented Aug 28, 2019

This should be fixed by PR #237. Can you confirm?

@prabhat00155
Copy link
Contributor Author

Yes, it has been fixed now. Thanks!

@xadupre xadupre moved this from To do to Done in Mismatches Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Mismatches
  
Done
Development

No branches or pull requests

2 participants