Reputation: 63
Let's say I have a vector of neural network output { y1, y2, ... , yi } for some input x, where i-th element of the output represents the probability of x being classified as class i. Also I know correct classification of x, which is represented by vector y = { 0, 0, ..., 1, ..., 0 }, which is filled by zeros and contains 1 at the j-th position, which represents that x should be classified as j class.
How do I measure whether the neural network has classified input correctly? Do I pick the highest probability from the output vector and determine whether such classification is identical to the correct one? Or do I convert all output probabilities to closest integer value and compare the new vector with vector y (if some missmatches exist, I would assume that the network failed to classify input correctly)? And how should I calculate accuracy of the network? Accuracy = correct classifications / all classifications?
Upvotes: 1
Views: 531
Reputation: 11377
You simply take the output with the highest probability as your result, rest gets discarded (under assumption there is only one correct class). When you check your accuracy against the correct label, you will get what is sometimes called a top-1 result. With top-5 you would take 5 highest scores and check if any of these classes match the label.
Upvotes: 1