Understand the idea
Asking a model to grade its own homework (testing it on the exact data it just learned from) will almost always make it look better than it really is. A flexible enough model (many parameters, a deep tree, a complex network) can push its training accuracy toward 100% simply by memorizing the training examples, including their noise and their quirks, rather than learning anything that generalizes.
This is exactly the overfitting problem: training accuracy keeps climbing as a model is made more flexible, right past the point where its actual usefulness on NEW data has started to fall. The training score and the real-world score can move in OPPOSITE directions once a model becomes too flexible for the amount of data available.
The only trustworthy measure of a model's real performance is its score on data it did not see during training: a held-out test set, or the average across several cross-validation folds. Any performance number computed on the training set alone should be treated as an upper bound at best, not as the model's real capability.
In-sample performance, the accuracy measured on the same rows the model was fitted to, is almost always better than the accuracy on new data.
Practitioner explanation
Training-set performance is a biased estimator of generalization error specifically because model FITTING directly optimizes that same training-set loss; the bias grows with model flexibility relative to n and is the textbook definition of the variance term in the bias-variance decomposition becoming dominant. No adjustment to a training-set metric alone (short of an explicit penalty like AIC/BIC, or actual out-of-sample evaluation) corrects for this.
The diagnostic is the gap between training and cross-validated performance: a small gap indicates the model's flexibility is well matched to the available data; a large gap (near-perfect training accuracy, much lower CV accuracy) is the signature of overfitting and should prompt regularization, a simpler model class, or more data rather than trusting the training number.
KernelStats' Cross-Validated Model Comparison is KernelStats's dedicated tool for this and its one-standard-error rule exists specifically to prevent choosing a model that scores marginally better on training data (or even on one particular CV split) purely by chance; the machine-learning cards (decision tree, random forest, gradient boosting, k-NN, neural network, naive Bayes, LDA/QDA, SVM) headline cross-validated metrics and show the in-sample figure only for comparison. The classical fitted-model cards (linear and logistic regression) report in-sample R-squared, accuracy and AUC, so for those the honest out-of-sample number comes from Cross-Validated Model Comparison.
Worked example
Scenario
A decision tree grown to full depth on a training set of 200 rows achieves 100% training accuracy.
Result
5-fold cross-validation on the same 200 rows gives a mean accuracy of 68%.
Interpretation
The tree has essentially memorized the training rows rather than learning a generalizable pattern, a classic overfitting signature. The 68% cross-validated figure, not the 100% training figure, is the honest estimate of how the model will perform on genuinely new data; pruning the tree or limiting its depth is the standard remedy.
Common misconceptions
Misconception
A classifier with 99% accuracy on its training data is a 99%-accurate model.
Correction
That figure describes fit to the data the model has already seen and can be artificially inflated by overfitting. The model's real accuracy on new data can be substantially lower, and only a held-out test set or cross-validation reveals the actual figure.
References
- NIST/SEMATECH e-Handbook of Statistical Methods, §4.4.3.7 Model validation, NIST/SEMATECH (2012), §4.4.3.7.
