Why my test accuracy higher than validation accuracy?
47 views (last 30 days)
Show older comments
I am using classification learner app. I get test accuracy higher than validation accuracy. For example 94.61% Accuracy (Validation), 94.81% Accuracy (Test). I'm sure I've splitted the train and test sets correctly. Why is test accuracy higher? How can i solve this? I would be grateful if you help.
4 Comments
the cyclist
on 29 Apr 2023
- training -- to fit the model
- validation -- to tune hyperparameters
- test -- to evaluate the final model choice
(This oversimplified, for brevity.)
Typically, training performace > validation performance > test performace.
(Again, oversimplified for brevity.)
So, his result is slightly more surprising than the two-stage method you describe. (I expect he did not train on the test set, as you are describing.)
See my answer for my take on the whole thing, which is effectively the same as your broader point, which is that the difference is small and not surprising.
John D'Errico
on 29 Apr 2023
Ok. That makes sense. Regardless, the difference is tiny, and could easily have been the other way.
Accepted Answer
the cyclist
on 29 Apr 2023
Edited: the cyclist
on 29 Apr 2023
There is no mystery here. Although in general a classifier will perform a little less well on the test set, sampling error can lead to a "lucky" test set, and you end up classifying it better.
Think of it like this. Suppose your validation accuracy is 95%, and the true accuracy of your model is really only 93%. It is still the case that you could perform better on any given randomly drawn test case. You could even get 100% accuracy in the test set.
There is a nice, fairly comprehensive discussion of these points by Jason Brownlee. Quoting from Kuhn and Johnson (from that article): "The uncertainty of the test set can be considerably large to the point where different test sets may produce very different results."
0 Comments
More Answers (0)
See Also
Categories
Find more on Classification Learner App in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!