Keras Grid正在搜索CNN并收到此错误:“;只能在val_auc可用的情况下保存最佳模型,跳过。”;

Keras Grid正在搜索CNN并收到此错误:“;只能在val_auc可用的情况下保存最佳模型,跳过。”;,keras,neural-network,gridsearchcv,Keras,Neural Network,Gridsearchcv,我正在尝试运行gridsearch查找最高的val_auc并保存最佳模型,但它停止保存,因为对于每个模型,验证分数称为val_auc2,val_auc3。。。依此类推,因此它无法检查val\u auc的分数。如果监视值不断更改名称,如何迭代保存模型 early_stop = tf.keras.callbacks.EarlyStopping(min_delta = .05, patience=5) checkpoint_filepath = "model_checkpoints/{epo

我正在尝试运行gridsearch查找最高的val_auc并保存最佳模型,但它停止保存,因为对于每个模型,验证分数称为val_auc2,val_auc3。。。依此类推,因此它无法检查
val\u auc
的分数。如果监视值不断更改名称,如何迭代保存模型

early_stop = tf.keras.callbacks.EarlyStopping(min_delta = .05, patience=5)
checkpoint_filepath = "model_checkpoints/{epoch:d}"
model_checkpoint_callback = tf.keras.callbacks.ModelCheckpoint(
    filepath=checkpoint_filepath,
    save_weights_only=False,
    monitor='val_auc',
    mode='max',
    save_best_only=True,
    save_freq='epoch')
params_deep = {
    "layout":['3x3', '5x5', '2*3x3'],
    "dense_neurons":[64, 128],
    "filters":[8, 16, 32],
    "dropout":[0.1, 0.5],
    "pooling":[None, 1],
    "epochs":[14]
}

nn_deep = KerasClassifier(build_fn=model_func_deep, batch_size=680, verbose=1)
gs_deep = GridSearchCV(estimator=nn_deep, param_grid=params_deep, cv=3, scoring = 'average_precision')
gs_deep.fit(X_train, y_train, validation_data=(X_test, y_test), callbacks = [early_stop, model_checkpoint_callback])