【发布时间】:2020-04-17 13:34:54
【问题描述】:
在我与机器学习相关的项目中,使用 CNN keras 进行花卉识别..显示以下错误 错误:
Anaconda3\lib\site-packages\keras\callbacks\callbacks.py:846: RuntimeWarning: Early stopping conditioned on metric `val_acc` which is not available. Available metrics are: val_loss,val_accuracy,loss,accuracy
(self.monitor, ','.join(list(logs.keys()))), RuntimeWarning
关于代码:
#using Grid Search and Early stopping
es = EarlyStopping(monitor='val_acc', verbose=2, patience=25)
mc = ModelCheckpoint('./best_model_1.h5', monitor='val_acc', verbose=2, save_best_only=True)
Hyp_Model_1 = KerasClassifier(build_fn=Revised_1_fn)
#You need to pick the right hyper-parameters for your training (try with different ones)
learn_rate = [0.01]
batch_size = [32,75,100]
epochs = [5]
param_grid = dict(batch_size=batch_size, epochs=epochs, learn_rate = learn_rate)
randSearch_1 = GridSearchCV(estimator = Hyp_Model_1, param_grid=param_grid, cv=5)
new_grid_1 = randSearch_1.fit(X_train,y_train, validation_data = (X_val, y_val), verbose=2,callbacks=[es,mc])
【问题讨论】:
-
错误消息清楚地指导您了解确切的问题是什么以及在您的代码中进行哪些更改。
标签: keras