onnx / sklearn-onnx

Convert scikit-learn models and pipelines to ONNX
Apache License 2.0
557 stars 104 forks source link

Convert back from ONNX to Sklearn #740

Closed vewald closed 3 years ago

vewald commented 3 years ago

Hi,

I am wondering whether ONNX model can be converted back to Sklearn?

xadupre commented 3 years ago

It is not possible. One reason is the ONNX only keeps information about inference, not training. A linear regression looks the same whether it was built with class LinearRegression or Ridge or ...

vewald commented 3 years ago

@xadupre : Alright that's good to know. I'm also wondering whether the cost function can be accessed and modified in ONNX?

xadupre commented 3 years ago

What do you mean by the cost function? The cost function is part of the training but it should not change the inference. After the conversion of a pipeline to ONNX, it is possible store some information in the ONNX description (doc_string). You may also store numerical parameter as initializer (see example Store arrays in one onnx graph).

vewald commented 3 years ago

@xadupre Like training it directly on ONNX.. I saw some operators here: https://github.com/onnx/onnx/blob/master/docs/Operators.md

I saw something like ReLU or MaxPooling... Aren't these functions meant to modify the cost function? Or does these operators working like a wrapper for another libraries?

xadupre commented 3 years ago

They are mostly using for deep learning models coming from tensorflow or pytorch. It is not possible to train with ONNX but it is for some models with onnxruntime, see https://github.com/microsoft/onnxruntime-training-examples.

xadupre commented 3 years ago

May I close this issue?

vewald commented 3 years ago

Yes, I considered it as closed.