CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Bias and Variance

Bias and variance are the two main ways a model's predictions go wrong. Too much bias means the model is too simple and underfits. Too much variance means it has memorised its training data and overfits. This lesson shows how to read each from a scenario, what fixes each one, and why a model that…

10 cards
Study this deck

Bias and Variance

Bias and variance are the two main ways a model's predictions go wrong. Too much bias means the model is too simple and underfits. Too much variance means it has memorised its training data and overfits. This lesson shows how to read each from a scenario, what fixes each one, and why a model that looks accurate overall can still fail a whole group of people.

Two kinds of error

When a model makes mistakes on new data, the cause is usually one of two things. Bias, in the statistical sense, is error from assumptions that are too simple: the model can't capture the real pattern, so it's wrong in a consistent way. Variance is error from being too sensitive to the training data: the model has learned the details and noise of the examples it saw, so its predictions swing when the data changes.

Making a model more complex usually lowers bias but raises variance. The goal is the balance point where error on new data is lowest. Note that this statistical "bias" differs from bias in the fairness sense, which means outcomes that are skewed against a group. The two can be connected, as the last section shows.

High bias means underfitting

An underfit model does poorly on its training data and on new data, because it never learned the pattern in the first place. Typical causes are a model that is too simple, too few useful input features, or training that stopped too soon. Typical fixes are a more capable model, better features, or more training passes (epochs).

High variance means overfitting

An overfit model scores very well on its training data but much worse on new data. That gap between training and test results is the signature. Typical causes are a very complex model, too little training data, or training for too long.

Fixes include more training data, data augmentation, early stopping (ending training before the model starts learning noise), regularization (penalising unhelpful complexity) and simplifying the model. To detect overfitting before launch, teams use k-fold cross-validation: they split the data into several parts, train on all but one, test on the one held out, and rotate until every part has been the test set.

Effects on demographic groups

A single overall accuracy number can hide serious problems. Imagine a model that is 95% accurate overall, where one group makes up only 3% of the data. The model can be badly wrong for that group while the average still looks fine. Both kinds of error can cause this:

  • Variance for small groups. With few examples of a group, the model's behaviour for that group rests on a handful of cases, noise included, so it generalises poorly to new members of the group.
  • Bias for distinct groups. A model too simple to capture how one group's pattern differs will apply the majority's pattern to everyone.

The result is inaccuracy that falls unevenly, which becomes a fairness problem. The fix starts with measuring accuracy separately for each group, then usually means collecting more representative data.

On the exam

SymptomDiagnosisTypical fix
Poor on training and new dataHigh bias, underfittingMore capable model, better features, train longer
Great on training data, poor on new dataHigh variance, overfittingMore data, augmentation, early stopping, regularization
Good overall, poor for one groupUnder-representationPer-group metrics, more data for that group

Don't mix up the fixes: early stopping and regularization treat overfitting, and they make underfitting worse.

Quiz me on this
A data science team describes its model as having high variance. Which behaviour should a reviewer expect?
  1. Poor results on both training data and new data alike
  2. Identical results no matter which data it is trained on
  3. ✓ Strong on training data but much weaker on new data
  4. Results that improve steadily the longer it is trained
A logistics company's delivery-time model is inaccurate on its training data and on new routes alike. The team has used only two input features so far and stopped training after a single pass. Which change is MOST likely to help?
  1. ✓ Add more relevant features and train for more passes
  2. Apply strong regularization to penalise model complexity
  3. Use early stopping so that training ends even sooner
  4. Remove one of the two features to simplify the model
An insurer's claims-approval model is 94% accurate overall. An audit finds it is only 71% accurate for claimants in rural areas, who make up 3% of the training data. The insurer must keep serving rural claimants accurately. Which action BEST addresses the problem?
  1. Retrain until overall accuracy rises above 97%, then redeploy
  2. Drop the location feature so the model can't treat rural claims differently
  3. Apply early stopping, since the model is clearly overfitting all claims
  4. ✓ Track accuracy by area and add more rural claims to the training data
A startup has a limited amount of labeled data. Before launch, it wants evidence that its model will hold up on data it hasn't seen, without setting aside a large separate test set. Which technique fits BEST?
  1. Data augmentation, creating modified copies of the existing examples
  2. ✓ K-fold cross-validation, rotating the held-out part
  3. Training for more epochs until training accuracy reaches 100%
  4. Regularization, adding a penalty for unnecessary complexity
Bias (statistical) in a model
Error from overly simple assumptions. High bias means the model underfits and is wrong in a consistent way.
Variance in a model
Error from being too sensitive to training data. High variance means the model overfits and does poorly on new data.
Bias-variance trade-off
More model complexity usually lowers bias but raises variance. The goal is the balance with the lowest error on new data.
Fixes for overfitting
More training data, data augmentation, early stopping, regularization and a simpler model.
K-fold cross-validation
Split data into K parts, train on K-1 and test on the remaining one, rotating until each part has been tested, then average the scores.
Why overall accuracy can hide unfairness
A small group's poor results barely move the average, so a model can look accurate while failing that group. Measure each group separately.