[Solved] RuntimeError: Cannot clone object <keras.wrappers.scikit_learn.KerasClassifier object…

Today, I debugged the code and found this error. The complete contents are as follows:

RuntimeError: Cannot clone object < keras. wrappers. scikit_ learn. KerasClassifier object at 0x000003A783733F33>, as the constructor either does not set or modifies parameter layers

No error is reported when the code is found. It is normal

The code is then investigated:

from keras.wrappers.scikit_learn import KerasRegressor

Change to:

from tensorflow.keras.wrappers.scikit_learn import KerasRegressor

Problem solved!

Read More: