Trading_Strategy_using_Cross_Validation -- No module named 'tensorflow.keras.wrappers'

from tensorflow.keras import Sequential

from tensorflow.keras.layers import Dropout, Dense, Activation, BatchNormalization

from tensorflow.keras.callbacks import ModelCheckpoint

from tensorflow.keras.wrappers.scikit_learn import KerasClassifier

#from tensorflow.keras.layers import 



from sklearn.model_selection import GridSearchCV


Import custom functions from data_modules


from Keras_CV import create_new_model

# Set a random seed
np.random.seed(42)

Hello,



There could be different reasons why you are getting this error. Can you let me know which section and unit did you get this error in?



One reason could be due to an incompatible version of Keras being installed in the local system. It should work in the version:2.5.0



You can try a workaround and install another library: scikeras, with the following command in the jupyter notebook



!pip install scikeras

from scikeras.wrappers import KerasClassifier



Do let me know if this helps. However, I would like to know which version of keras is installed in your local system. Also, is it possible for you to install the machine learning virtual environment in the blog "https://blog.quantinsti.com/set-up-python-system/"? This should help you install the compatible versions of various python libraries.



Thanks.

Thanks.

Neural Network course 

Section 7: Trading_Strategy_using_Cross_Validation.ipynb



Still not working 

Keras: 2.15.0



#!pip install scikeras

from scikeras.wrappers import KerasClassifier



after this, error on code cell 15, 



=======================================================

grid_result = grid.fit(X_train, y_train, clf__class_weight=class_weight)

=========================================================
1171                 " `estimator.get_params().keys()`"
   1172             ) from None
   1173 return self

ValueError: Invalid parameter act_1 for estimator KerasClassifier.
This issue can likely be resolved by setting this parameter in the KerasClassifier constructor:
`KerasClassifier(act_1=tanh)`
Check the list of available parameters with `estimator.get_params().keys()`

Hi,



Can you confirm if you tried installing the machine learning virtual environment in the blog "https://blog.quantinsti.com/set-up-python-system/"? This should help you install the compatible versions of various python libraries.



The virtual environment will help you avoid errors in Python.