Computer ScienceAI & Machine LearningEasy

Overfitting

Also known as:High VarianceOvertraining

Overfitting occurs when a machine learning model learns the training data too well — including its noise and random fluctuations — to the point where it performs poorly on new, unseen data. An overfitted model has high training accuracy but low validation/test accuracy, indicating it has memorized patterns specific to the training set rather than generalizing. Overfitting is more likely with complex models, small datasets, or insufficient regularization.

Overfitting vs Underfitting vs Good Fit

ScenarioTraining ErrorValidation ErrorSymptomFix
UnderfittingHighHighModel too simpleIncrease model complexity
Good FitLowLow (similar)Balanced generalizationNone needed
OverfittingVery lowHighModel memorized dataRegularization, more data
Severe OverfittingNear zeroVery highNoise memorizedSimpler model, dropout

Interactive Tools

Scikit-learn — Validation Curves

Tools to diagnose overfitting using learning and validation curves

Open Tool

TensorFlow Playground

Visually observe overfitting by changing model complexity and data size

Open Tool

Khan Academy — Overfitting

Explains training vs testing data and why overfitting occurs

Open Tool
Graph comparing an overfit curve that zigzags through data points with a smooth generalized fit

Wikimedia Commons, CC BY-SA

Related Terms

Computer Science

Cross-Validation

Cross-validation is a statistical technique for evaluating a machine learning model's ability to generalize to an independent dataset. The most common form, k-fold cross-validation, partitions the training data into k equally sized subsets; the model is trained on k−1 folds and evaluated on the remaining fold, repeating this process k times and averaging the results. Cross-validation provides a more reliable performance estimate than a single train-test split and helps in selecting hyperparameters and comparing models.

Computer Science

Supervised Learning

Supervised learning is a machine learning approach where a model is trained on a labeled dataset, meaning each training example is paired with the correct output (label). The model learns a mapping from inputs to outputs by minimizing the difference between its predictions and the true labels. It is the most widely used ML paradigm and underpins applications such as image recognition, speech transcription, and credit scoring.

Computer Science

Machine Learning

Machine learning is a branch of artificial intelligence in which systems learn from data to improve their performance on tasks without being explicitly programmed for each task. It works by identifying statistical patterns in training data and using those patterns to make predictions or decisions on new, unseen data. Machine learning powers applications ranging from spam filters and recommendation engines to medical diagnosis and autonomous vehicles.

"Overfitting" is a compound formed from "over" (Old English "ofer," meaning excessively) and "fit" (to conform closely to). The concept was recognized in statistical modeling in the mid-20th century and became central to machine learning theory in the 1990s.

overfittinggeneralizationregularizationbias-variancetraining