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

Handle issue with binary classifier setting output to [N,1] vs [N,2] #681

Merged

Conversation

casassg
Copy link
Contributor

@casassg casassg commented Feb 14, 2024

There's an issue on binarry classifier when passing a booster object.

WrappedBooster will set num_class to 1 as trees//ntrees == 1 https://github.com/casassg/onnxmltools/blob/e7a2ef088fb336800d34bffa628abac79f1ecc14/onnxmltools/convert/xgboost/_parse.py#L100

This makes it such that when we try to calculate the ncl for the classifier we end up setting an output of N, 1 vs N,2 which is what ONNX will actually calculate. These produce errors on logs in onnx runtime.

Given binary:logistic will always produce [N,2] changing the order in the if clause should remove the error.

I can add a test to repro but wanted to send PR first for feedback.

Also removed a double assignation which I'm not certain why it was there.

@xadupre xadupre merged commit b1e1068 into onnx:main Apr 2, 2024
15 checks passed
@casassg casassg deleted the casassg/fix-binary-classifier-output-count branch June 4, 2024 21:01
@casassg
Copy link
Contributor Author

casassg commented Dec 5, 2024

@xadupre any chance to do a release w this change?

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.

2 participants