You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some day ago I was trying to add a Keras model to scikit-learn Pipeline using SKLearnClassifier (wrapper), but I got this error when doing .fit() (notwithstanding the model was already compiled):
RuntimeError: Given model needs to be compiled, and have a loss and an optimizer.
So I made this example code to check if the clone_model function that the API uses does indeed keep the compiled model:
I'm glad to say that the proposed solution worked perfectly, I was able to integrate the Neural Network to the SKlearn Pipeline and export it to use it in another Python project.
I was able to work around this issue by passing a function to SKLearnClassifier instead of the instance. Not sure why this works though
Some day ago I was trying to add a Keras model to scikit-learn Pipeline using SKLearnClassifier (wrapper), but I got this error when doing .fit() (notwithstanding the model was already compiled):
RuntimeError: Given model needs to be compiled, and have a loss and an optimizer.
So I made this example code to check if the clone_model function that the API uses does indeed keep the compiled model:
And the output:
I think that's probably the reason why SKLearnClassifier is not working well.
Unfortunately, I couldn't find a way to solve this issue.
The text was updated successfully, but these errors were encountered: