Skip to main content
Albero Academy

Overfitting & Bias-Variance

The central tension in ML — and how to diagnose it.

Model Selection & Unsupervised9 min

The core challenge of ML is generalisation: performing well on new data, not just the training set. The bias-variance trade-off frames the two ways a model can fail.

Underfitting vs overfitting

  • Underfitting (high bias) — too simple; poor on both train and test. Fix: a richer model, more features.
  • Overfitting (high variance) — memorises training noise; great on train, poor on test. Fix: more data, regularisation, simpler model.

Diagnosing it

compare train vs test
train_score = model.score(X_train, y_train)
test_score = model.score(X_test, y_test)
# train high, test much lower → overfitting
# both low → underfitting
# both good and close → healthy

Key takeaways

  1. 01The goal is generalisation — good performance on unseen data.
  2. 02Underfitting (high bias): too simple, poor on train and test.
  3. 03Overfitting (high variance): memorises noise — great on train, poor on test.
  4. 04Diagnose by the train-vs-test gap; fix overfitting with regularisation, simpler models, or more data.

Finished this chapter?

Mark it complete to track your progress through Scikit-learn.