Handle issue with binary classifier setting output to [N,1] vs [N,2] #681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.