## Classification Accuracy in Keras

5

I'm using two different functions to calculate the accuracy of my deep learning model and I am confused which one is which.

The first one is

    loss, accuracy = model.evaluate(x_train, y_train, verbose=0)
print('Accuracy: %f' % (accuracy))
print('Loss: %f' % (loss))

Accuracy: 0.731495
Loss: 1.136258


And the second way is to obtain the accuracy:

test_accuracy = history2.history['val_acc']


Accuracy is 0.731 and test_accuracy is around 0.21 Which is one is my models' accuracy

4That's interesting, you are performing badly on your training set(underfitting probably) and so bad on your test set, .731 is for those set of data for which you know the answer already, and the second no is for the unknown test data – Aditya – 2018-05-31T12:30:56.290

Should be as Adtiya said, try loss, accuracy = model.evaluate(x_test , y_test verbose=0) and print again. Accuracy should be the same as history2.history['val_acc'] – nsaura – 2018-09-03T11:06:10.290

test_accuracy = history2.history['val_acc']