Reputation: 79
Is there a way to calculate the training accuracy after completing training process with Keras or Tensorflow?
Upvotes: 3
Views: 2706
Reputation: 3288
model.history
has all the information required.
For example, after running model for 5 epochs, you can access the loss and accuracy as follows
history=model.history.history
print(history)
{'loss': [0.2212433920122683, 0.097910506768773, 0.06874677832927555, 0.05441241036520029, 0.0430859369851804], 'accuracy': [0.9342333, 0.9698667, 0.97786665, 0.98211664, 0.9856]}
If you want to access loss
and accuracy
during model.evaluate
, you can do as follows
history2 =model.evaluate(x_test, y_test)
print(history2) # output[0.07691180044879548, 0.9772]
Upvotes: 3