How to save best model in Keras based on AUC metric?
问题 I would like to save the best model in Keras based on auc and I have this code: def MyMetric(yTrue, yPred): auc = tf.metrics.auc(yTrue, yPred) return auc best_model = [ModelCheckpoint(filepath='best_model.h5', monitor='MyMetric', save_best_only=True)] train_history = model.fit([train_x], [train_y], batch_size=batch_size, epochs=epochs, validation_split=0.05, callbacks=best_model, verbose = 2) SO my model runs nut I get this warning: RuntimeWarning: Can save best model only with MyMetric