History of model.fit

In keras . I am accesing history.history[“acc”] . and I am getting a key error . can you tell me what is the key for accuracy in history dict of model.fit

You might try adding this code to see what keys are actually being used…

print(history.history.keys())

Note: the lookup key must match the one used in creating the metrics in the first place. There was a non-backwards compatible change at one point that could come in to play depending on exactly what code you’re running in which environment…

  • Metrics and losses are now reported under the exact name specified by the user (e.g. if you pass metrics=['acc'], your metric will be reported under the string “acc”, not “accuracy”, and inversely metrics=['accuracy'] will be reported under the string “accuracy”.
1 Like