Closed praneeth5222 closed 1 year ago
That's a bit general of a question. Models ran via ONNX are no longer TensorFlow models I think, so SciKeras would not be compatible with them (that is, SciKeras can't wrap an ONNX model)
Thank you @adriangb for your quick response. Tensorflow models can be converted to ONNX using tf2onnx module but I'm unable to find a module to convert a scikeras class to ONNX
SciKeras is just a shimmy between scikit learn models and tensorflow models. I'd recommend you convert the actual tensorflow model to ONNX. SciKeras is not in and of itself a machine learning framework.
Got it!! Thank you.
I know I have closed this thread @adriangb; I just wanted your suggestion if you have any for the problem I'm facing with
So i have a Keras model that I wanted to use along with sklearn CalibratedClassifierCV to calibrate the probability outputs and convert the entire pipeline to ONNX.
Since keras model doesn't have predict_proba method inbuilt which is a requirement for CalibratedClassifierCV; I have tried to use KerasClassifier to wrap the keras model so that I can use it for calibration but then if I do so I'm not able to convert the pipeline to ONNX because of the KerasClassifier
Any thoughts or suggestions here?
convert the entire pipeline to ONNX.
That’s going to be the issue: as far as I know ONNX introspects the Pipeline and special cases sklearn transformers and models that it recognizes. It won’t recognize the wrapped tensorflow model unfortunately. Could you export just the TensorFlow model and re-create your sklearn pipeline when you want to do inference and use it as a transformer?
Could you export just the TensorFlow model and re-create your sklearn pipeline when you want to do inference and use it as a transformer?
Do you mind explaining this, when you say recreating your sklearn pipeline? Here I do want to recalibrate the prediction probabilities from the Tensorflow Keras model every time the model train happens and use them both in the runtime using ONNX
Hi @adriangb I have stumbled on this issue once again. Can you explain the above-said statement?
Hello @adriangb
Can you guide me in using KerasClassifier in ONNX runtime?