Closed nabilalibou closed 1 year ago
It is because fitting a KerasClassifier reset the neural network weights unlike fitting a Keras model. I am closing the issue.
I was on vacation but was just about to look into this! Sorry for the delay.
fitting a KerasClassifier reset the neural network weights unlike fitting a Keras model
Indeed in the scikit-learn API calling fit()
resets the model. Maybe you want partial_fit or warm_start?
Hello,
I have a rather strange bug: Wrapping a model with KerasClassifier will decrease its performance (binary accuracy) by about 10%.
The code above will consistently gives me an average accuracy across 30 runs * 10 kFold split of 67% binary accuracy.
Whereas this code without using KerasClassifier:
Will consistently gives me 78% of binary accuracy.
I tried to put the model out of the function and define it directly in the script, to put the compilation outside of model_nn(), to put the compilation parameters in KerasClassifier() etc... In any combination wrapping the model in KerasClassifier, fitting and predicting with it gives me less accuracy. What do I not see ? Thank you in advance for your time
I am using: