Reputation: 515
I'm running Jupyter notebook in a conda virtual environment (Ubuntu), and first entered:
import tensorflow as tf
from tensorflow import keras
from keras.wrappers.scikit_learn import KerasClassifier
As you can see in the image below, it appears that keras has been imported. However, when I try to import a function from keras.wrappers.scikit_learn I get an error message suggesting that keras hasn't been imported. What am I missing here??
Upvotes: 1
Views: 4567
Reputation: 353
Make sure you have keras
installed as separate package as well.
pip install keras
Upvotes: 2
Reputation: 515
I'm not sure why (and am open to answers!), but the following syntax results in no errors:
from tensorflow.keras.wrappers.scikit_learn import KerasClassifier
Upvotes: 4