TF1-C2W2 Graded Assignment. RMSprop not defined

Received this error after running model.compile:

NameError Traceback (most recent call last)

in 1 # Get the untrained model ----> 2 model = create_model() 3 4 # Train the model 5 # Note that this may take some time.

in create_model() 20 21 —> 22 model.compile(optimizer= RMSprop(learning_rate=1e-4), 23 loss=‘binary_crossentropy’, 24 metrics=[‘accuracy’])

NameError: name ‘RMSprop’ is not defined
How can “RMSprop” not be defined?

you have to options:
if you need to use it this way, then you have to import the RMSprop first like this:

from tensorflow.keras.optimizers import RMSprop

if you won’t have to change the learning rate or any other customizations to the optimizer, then you can just type ‘rmsprop’ in single or double quotatoins like this:
model.compole(optimizer = ‘rmsprop’, loss= …etc)

1 Like

Thank you for helping.

1 Like