Bias-Variance Tradeoff

GATE Relevance: High

🎯 Learning Objectives

  • Define bias and variance in the context of machine learning models
  • Derive the bias-variance decomposition of expected prediction error
  • Understand how model complexity affects bias and variance
  • Apply strategies to reduce bias or variance as needed

1. What is Bias?

Bias

Bias measures how far off the model’s average prediction is from the true value. It captures the error introduced by approximating a complex real-world problem with a simpler model.

Bias = E[f̂(x)] − f(x)

  • High bias means the model makes strong assumptions about the data (e.g., assuming linearity when the true relationship is quadratic). The model systematically misses the relevant patterns. This leads to underfitting.
  • Low bias means the model’s average prediction is close to the true function. The model is flexible enough to capture the underlying pattern.
Example: Polynomial Regression

If the true function is y = x² + noise, fitting a straight line (degree 1) to the data will always miss the curvature, no matter how much data we have. The straight line has high bias.

2. What is Variance?

Variance

Variance measures how much the model’s predictions fluctuate across different training sets. It captures the model’s sensitivity to the specific data it was trained on.

Variance = E[(f̂(x) − E[f̂(x)])²]

  • High variance means the model fits the training data very closely, including noise. Different training sets produce very different models. This leads to overfitting.
  • Low variance means the model is stable — similar training sets produce similar models.
Example: Polynomial Regression

Fitting a degree-20 polynomial to 10 data points will produce wildly different curves for different samples of 10 points. The degree-20 polynomial has high variance.

3. Bias-Variance Decomposition

The expected prediction error for a model at a given point x can be decomposed into three components:

Bias-Variance Decomposition

E[(y − f̂(x))²] = Bias² + Variance + Irreducible Error

Expanding:

E[(y − f̂(x))²] = [E[f̂(x)] − f(x)]² + E[(f̂(x) − E[f̂(x)])²] + σ²

where σ² is the variance of the noise in the data (irreducible error).

Proof Sketch

Let y = f(x) + ε where E[ε] = 0 and Var(ε) = σ².

E[(y − f̂)²] = E[(f + ε − f̂)²]

= E[(f − f̂)²] + E[ε²] + 2E[(f − f̂)ε]

Since ε is independent of f̂, the cross term is 0. Thus:

= E[(f − f̂)²] + σ²

Now add and subtract E[f̂]:

E[(f − f̂)²] = E[(f − E[f̂] + E[f̂] − f̂)²]

= (f − E[f̂])² + E[(f̂ − E[f̂])²] + 2(f − E[f̂])E[f̂ − E[f̂]]

The last term is 0 (since E[f̂ − E[f̂]] = 0), giving us:

= Bias² + Variance

The Three Components
  • Bias²: Systematic error from wrong assumptions. Cannot be reduced by more data alone — need a more flexible model.
  • Variance: Error from sensitivity to training data fluctuations. Can be reduced with more data, regularisation, or simpler models.
  • Irreducible Error (σ²): Inherent noise in the data. Cannot be reduced by any model — it sets a floor on achievable error.

4. Model Complexity Curve

As model complexity increases (e.g., polynomial degree, tree depth, number of parameters):

  • Bias decreases: More complex models can fit more patterns
  • Variance increases: More complex models are more sensitive to training data
  • Total error: First decreases (bias drops fast), then increases (variance rises faster)
ComplexityBiasVarianceTraining ErrorTest ErrorDiagnosis
Too lowHighLowHighHighUnderfitting
OptimalModerateModerateModerateLowestGood fit
Too highLowHighVery lowHighOverfitting
Polynomial Regression Example

True function: y = 3x² + 2x + 1 + noise

  • Degree 1 (linear): High bias (cannot capture x² term), low variance → underfitting
  • Degree 2 (quadratic): Low bias (matches true form), moderate variance → good fit
  • Degree 15: Very low bias (can fit anything), very high variance (fits noise) → overfitting

5. Bias-Variance for Common Algorithms

AlgorithmBiasVarianceNotes
Linear RegressionHigh (if non-linear)LowParametric; limited flexibility
KNN (K=1)LowVery highMemorises training data
KNN (large K)HighLowOver-smooths boundaries
Decision Tree (deep)LowHighCan fit any training set perfectly
Decision Tree (pruned)ModerateModeratePruning reduces variance
Random ForestLowModerateEnsemble reduces variance
SVM (RBF, small γ)HighLowSmooth decision boundary
SVM (RBF, large γ)LowHighComplex, jagged boundary

6. Strategies to Manage Bias and Variance

6.1 Reduce High Bias (Underfitting)

  • Increase model complexity (e.g., add polynomial features, more layers)
  • Add more features (feature engineering)
  • Decrease regularisation strength
  • Use a more flexible model family (e.g., switch from linear to tree-based)
  • Train longer (for iterative algorithms)

6.2 Reduce High Variance (Overfitting)

  • Increase training data size
  • Reduce model complexity (fewer parameters, shallower trees)
  • Add regularisation (L1, L2, dropout)
  • Use ensemble methods (bagging, Random Forest)
  • Feature selection (remove noisy features)
  • Early stopping
  • Cross-validation for model selection
GATE Tip

A common GATE question pattern: “Training accuracy is 98%, test accuracy is 65%. What is the likely issue?” Answer: High variance (overfitting). The large gap between training and test error is the hallmark of overfitting.

7. GATE-Style Practice

GATE Example 1 (MCQ)

Q: As the number of training examples increases, which component of prediction error decreases?

(A) Bias   (B) Variance   (C) Irreducible error   (D) Both bias and variance

A: (B) Variance. More data helps the model generalise better, reducing its sensitivity to any particular training set. Bias is a property of the model family and doesn’t change with more data. Irreducible error is inherent.

GATE Example 2 (True/False)

Q: A model with zero training error always has low bias.

A: True. If the model perfectly fits the training data, it has captured the patterns (and noise), indicating low bias. However, it likely has high variance if the training data contains noise.

GATE Example 3 (MCQ)

Q: In the bias-variance decomposition, which term represents the inherent noise in the data that cannot be reduced by any model?

(A) Bias²   (B) Variance   (C) σ² (irreducible error)   (D) Cross-validation error

A: (C) σ² is the irreducible error — the minimum possible expected error, caused by noise in the target variable y itself.

8. Summary

  • Total Error = Bias² + Variance + Irreducible Error
  • Bias = systematic error from wrong assumptions (underfitting)
  • Variance = sensitivity to training data fluctuations (overfitting)
  • The tradeoff: reducing one often increases the other
  • Optimal model complexity is at the sweet spot where total error is minimised
  • Ensemble methods (Random Forests, Bagging) reduce variance without increasing bias