-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Added Onnx Export to PlattCalibratorTransformer #4699
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
Conversation
By the way, I tried to add more tests using the optional parameters of the PlattCalibratorEstimator, such as scoreColumnName, but it seems that API is broken. I've opened issue #4700 about this. If that issue gets fixed, then it would be a good idea to add more OnnxConversion tests to cover those cases and see if the onnx conversion still works when using "non-default" names. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -309,6 +309,40 @@ public void BinaryClassificationTrainersOnnxConversionTest() | |||
Done(); | |||
} | |||
|
|||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be part of your changes. Maybe you did your merge steps wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I messed up, but it's fixed now
Codecov Report
@@ Coverage Diff @@
## master #4699 +/- ##
=========================================
Coverage ? 75.86%
=========================================
Files ? 951
Lines ? 172526
Branches ? 18629
=========================================
Hits ? 130886
Misses ? 36464
Partials ? 5176
|
PlattCalibrator
already had aSaveAsOnnx
method (link) which was called when saving to Onnx aPlattCalibrator
through aCalibratedModelParameter
class (such as in here). This would happen when saving a model produced by a calibrated binary classifier.Besides being part of calibrated binary classifiers, a PlattCalibrator can also be used independently, through a
PlattCalibratorTransformer
. So in this PR I add the necessary code so to also make it possible to save as Onnx a model that used aPlattCalibratorTransformer
.I added 2 tests where a PlattCalibratorTransformer is added at the end of the model (in one test it's added on top of binary classifiers, in the other test no binary classifiers were used).
I also fixed a bug in the SaveAsOnnx method of PlattCalibrator. For some reason, it was hardcoded to use "-0.0000001f" as the value of the Offset, ignoring the actual offset that the calibrator had. This worked with the existing tests because in them the offset was actually "0", but that isn't always the case, and so in the tests that I am adding the offset is not 0.