why showing error here? I was trying to implement VGG16 model but there have an error...!!
model.compile(loss='categorical_crossentropy', optimizer=optimizers.Nadam(lr=2e-5), metrics=['acc'])
CodePudding user response:
keras.optimizers.Adam
https://keras.io/api/optimizers/adam/
It's a misspelled word
CodePudding user response:
Depending on which version of keras
and tensorflow
you are using, you can import Nadams in either way (keras
is now part of tensorflow
):
from tensorflow.keras.optimizers import Nadam
OR
from keras.optimizers import Nadam
and then use it as:
Nadam(learning_rate=0.0001)
Sample usage:
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.optimizers import Nadam
model = Sequential()
model.add(Dense(10, input_dim=20, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(optimizer=Nadam(learning_rate=0.0001), loss='binary_crossentropy', metrics=['accuracy'])
model.summary()