Bias-Variance Tradeoff
Study guides: Exam SRM, Exam PA, Exam MAS-I, Exam MAS-II, Exam PCPA, Exam ACIA-CAPSTONE, Exam F2FIE
The Bias-Variance Tradeoff is the relationship between the bias and the variance of a fitted model as its flexibility changes: a more flexible model has lower bias and higher variance. The expected test mean squared error at a point x_0 is
\begin{aligned} E\left[\left(y_0 - \hat{f}(x_0)\right)^{2}\right] &= \text{Var}\big(\hat{f}(x_0)\big) \\ &\quad + \left[\text{Bias}\big(\hat{f}(x_0)\big)\right]^{2} \\ &\quad + \text{Var}(\varepsilon) \end{aligned}
\hat{f}(x_0)is the model's prediction atx_0, andy_0is the response there.\text{Var}\big(\hat{f}(x_0)\big)is the variance of the prediction over the training sets the model could have been fitted to.\text{Bias}\big(\hat{f}(x_0)\big)isE\big[\hat{f}(x_0)\big] - f(x_0), the error from approximating the true functionfby the model.\text{Var}(\varepsilon)is the irreducible error, the variance of the error term inY = f(X) + \varepsilon.
No model can have an expected test MSE below \text{Var}(\varepsilon).
At a point
x_0the irreducible error is 25. Model A has bias-3and variance 16, and model B has bias-6and variance 4. Which model has the lower expected test MSE?
- The expected test MSE of model A is
16 + (-3)^2 + 25 = 50.- The expected test MSE of model B is
4 + (-6)^2 + 25 = 65.- Model A has the lower expected test MSE, although its variance is higher.
Flexibility and the test MSE
The flexibility of a model is the range of shapes it can fit, and it grows with the model's degrees of freedom. Linear regression is relatively inflexible, because it restricts the fit to a linear form. As flexibility increases:
- The squared bias decreases.
- The variance increases.
- The training MSE decreases, because the fitting procedure minimizes it.
- The test MSE first decreases and then increases, in a U-shape.
The expected test MSE curve lies above the sum of the variance and the squared bias by the constant \text{Var}(\varepsilon). A model to the left of the minimum underfits: it is too inflexible to capture the true relationship, for example because important predictors are left out, and its error is high on both the training and the test data. A model to the right of the minimum overfits: it fits the noise in the training data, so its training error is low and its test error is high. The minimum of the test MSE, estimated by cross-validation, marks the best flexibility.
Several methods trade bias for variance in the same way. Removing irrelevant predictors (variable selection) or increasing the penalty of ridge regression (regularization) reduces variance at the cost of bias, and the test error falls when the reduction in variance is larger than the added squared bias. A decision tree with more splits has lower bias and higher variance. With few observations per class, quadratic discriminant analysis has many parameters to estimate, so the less flexible naive Bayes classifier can have the lower test error.
A frequency model with territory in 8 groups has training deviance 2,400 and holdout deviance 2,510. With each of 220 postal codes as its own level, the training deviance is 1,950 and the holdout deviance is 2,890. Which model is overfitting?
- The 220-level model has the lower training deviance, because it is the more flexible model.
- Its holdout deviance is higher, 2,890 against 2,510, because most postal codes have too little data to estimate their own level, and the model has high variance.
- The 220-level model is overfitting. The 8-group model accepts some bias for a large reduction in variance.
Choosing the model with the lowest training error The training error falls with every increase in flexibility, so the most flexible model always looks best on the training data. The model is chosen by its test error, or by an estimate of it such as the cross-validated error.
Practice questions
- CAS Exam MAS-I Fall 2018, Question 37
- CAS Exam MAS-I Spring 2018, Question 34
- CAS Exam MAS-I Fall 2019, Question 28
- CAS Exam MAS-I Fall 2019, Question 30
- CAS Exam MAS-I Fall 2019, Question 34
- CAS Exam MAS-I Fall 2019, Question 38
- CAS Exam MAS-I Spring 2019, Question 28
- CAS Exam MAS-I Spring 2019, Question 40
- Exam MAS-I Practice Question 160
- CAS Exam MAS-I Sample Question 2
- CAS Exam MAS-I Sample Question 3
- CAS Exam MAS-II Fall 2018, Question 37
- CAS Exam MAS-II Fall 2019, Question 20
- CAS Exam MAS-II Fall 2019, Question 31
- CAS Exam MAS-II Fall 2019, Question 37
- CAS Exam MAS-II Spring 2019, Question 37
- CAS Exam MAS-II Spring 2019, Question 38
- Exam MAS-II Practice Question 7
- Exam PA Practice Question 4
- Exam PA Practice Question 5
- Exam PA Practice Question 6
- Exam PA Practice Question 29
- SOA Exam SRM Sample Question 8
- SOA Exam SRM Sample Question 12
- SOA Exam SRM Sample Question 25
- SOA Exam SRM Sample Question 50
- Exam SRM Practice Question 1
- Exam SRM Practice Question 2