Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (19k points)

I don't understand which accuracy in the output to use to compare my 2 Keras models to see which one is better.

Do I use the "acc" (from the training data?) one or the "val acc" (from the validation data?) one?

There are different accs and val accs for each epoch. How do I know the acc or val acc for my model as a whole? Do I average all of the epochs accs or val accs to find the acc or val acc of the model as a whole?

Model 1 Output

0s - loss: 0.1884 - acc: 0.8062 - val_loss: 0.2542 - val_acc: 0.7449

Model 2 Output

0s - loss: 0.1905 - acc: 0.8062 - val_loss: 0.2460 - val_acc: 0.7531

1 Answer

0 votes
by (33.1k points)

I think you want to ask which accuracy I should consider: validation accuracy or training accuracy.

It depends upon you that which accuracy you want to consider, If you want to consider the ability of your model to infer to new data, then check at the validation accuracy because the validation split contains only data that the model never sees during the training and therefore cannot just memorize.

If your training data accuracy keeps improving while your validation data accuracy gets worse, you are likely in an overfitting situation, i.e. your model starts to basically just memorize the data.

Each epoch is a training run over all of your data. During that run, the parameters of your model are adjusted according to your loss function. The highest accuracy in model 1 is 0.7737 and the highest one in model 2 is 0.7572. Therefore you should view model 1 (at epoch 3) as better. Though it is possible that the 0.7737 was just a random outlier. 

Hope this answer helps.

If you wish to learn Python, then check out this Python Course by Intellipaat.

Browse Categories