0

我正在编译我的模型

metrics=["accuracy", keras.metrics.Recall()]

如文档中所述。但是,当我在训练完模型后尝试获取它时,我得到了一个 key_error “召回”。两个版本,

recall = estimator_bio.history["Recall"]
recall = estimator_bio.history["recall"]

导致

KeyError: 'Recall'

尽管

accuracies = estimator_bio.history["accuracy"]

作品。召回的关键词是什么?

4

1 回答 1

1

您始终可以将名称传递给指标:

metrics=["accuracy", keras.metrics.Recall(name='recall')]

这样您就可以轻松地引用它。

无论如何,您应该打印或检查历史对象的内容以查看它包含的内容以及分配给的实际键/名称Recall(顺便说一句应该是recall)。

通常你要做的是:

# Fit the model
history = model.fit(.....)
# and then you can see what is available in the history with:
print(history.history.keys())
于 2020-12-08T19:11:03.603 回答