I got this error when I tried to modify the learning rate parameter of SGD optimizer in Keras. Did I miss something in my codes or my Keras was not installed properly?
Here is my code:
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Dense, Flatten, GlobalAveragePooling2D, Activation
import keras
from keras.optimizers import SGD
model = Sequential()
model.add(Dense(64, kernel_initializer='uniform', input_shape=(10,)))
model.add(Activation('softmax'))
model.compile(loss='mean_squared_error', optimizer=SGD(lr=0.01), metrics= ['accuracy'])*
and here is the error message:
Traceback (most recent call last): File
"C:TensorFlowKerasResNet-50est_sgd.py", line 10, in
model.compile(loss='mean_squared_error', optimizer=SGD(lr=0.01), metrics=['accuracy']) File
"C:Users
sugiantAppDataLocalProgramsPythonPython35libsite-packagesensorflowpythonkeras_implkerasmodels.py",
line 787, in compile
**kwargs) File "C:Users
sugiantAppDataLocalProgramsPythonPython35libsite-packagesensorflowpythonkeras_implkerasengineraining.py",
line 632, in compile
self.optimizer = optimizers.get(optimizer) File "C:Users
sugiantAppDataLocalProgramsPythonPython35libsite-packagesensorflowpythonkeras_implkerasoptimizers.py",
line 788, in get
raise ValueError('Could not interpret optimizer identifier:', identifier) ValueError: ('Could not interpret optimizer identifier:',
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…