Closed maxnoe closed 5 years ago
This output schema was decided while designing onnxruntime that was shipped with WINML(https://docs.microsoft.com/en-us/windows/ai/windows-ml/index). One reason for it being this way is that Coreml output is zipmap-like schema, and one of the main goals at that time was to be fully compatible with Coreml. e.g. skl.model -> coreml.model ->onnxml == skl.model->onnxml. At this moment, this behaviour would be difficult to change as it would violate Windows backward compatibility, and the huge test case suite that would need to be updated.
How much effort would it be to make this optional? So keep the current behaviour by default, but support the other one?
Let me check on this and get back, I think there is a way for you to remove the final zipmap node if you want scores similar to scikit.
Thanks!
You may use select_model_inputs_outputs(). Pass the model as parameter along with the list of outputs you want, and it would modify your onnx model. Here is an example:
from onnxmltools import load_model, save_model from skl2onnx.helpers.onnx_helper import select_model_inputs_outputs
model = load_model('model.onnx') save_model(select_model_inputs_outputs(model, ['output_label', 'probabilities']), 'model2.onnx')
Awesome, thank you!
Why are the scores returned by
output_probability
a list of dictioniaries? That is different from the sklearn api and much less efiicient for larger datasets.