algorithm - Evaluation & Calculate Top-N Accuracy: Top 1 and Top 5 -


i have come across few (machine learning-classification problem) journal papers mentioned evaluate accuracy top-n approach. data show top 1 accuracy = 42.5%, , top-5 accuracy = 72.5% in same training, testing condition. wonder how calculate percentage of top-1 , top-5?

can 1 show me example , steps calculate this?

thanks

top-1 accuracy conventional accuracy: model answer (the 1 highest probability) must expected answer.

top-5 accuracy means any of model 5 highest probability answers must match expected answer.

for instance, let's you're applying machine learning object recognition using neural network. picture of cat shown, , these outputs of neural network:

  • tiger: 0.4
  • dog: 0.3
  • cat: 0.1
  • lynx: 0.09
  • lion: 0.08
  • bird: 0.02
  • bear: 0.01

using top-1 accuracy, count output wrong, because predicted tiger.

using top-5 accuracy, count output correct, because cat among top-5 guesses.