jgklsdjfgkldsfaSDF
jgklsdjfgkldsfaSDF

Reputation: 69

Get the recall over the epochs in keras

I am compiling my model with

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

as stated in the documentation. But when I try to obtain it after I've trained my model I get a key_error "recall". Both versions,

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

result in

KeyError: 'Recall'

While

accuracies = estimator_bio.history["accuracy"]

works. What is the keyword for the recall?

Upvotes: 0

Views: 232

Answers (1)

Luca Angioloni
Luca Angioloni

Reputation: 2253

You can always pass a name to the metric:

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

this way you can reference it in an easy way.

Anyway you should print or inspect the contents of the history object to see what it contains and the actual key/name assigned to Recall (which by the way should be recall).

Usually what you do is:

# Fit the model
history = model.fit(.....)
# and then you can see what is available in the history with:
print(history.history.keys())

Upvotes: 1

Related Questions