A machine learning engineer is training a linear regression model on a dataset with 50 features. After training, the model achieves high accuracy on the training set but poor accuracy on the test set. Which technique should the engineer use to address this issue?
Regularization penalizes large coefficients and reduces overfitting.
Why this answer
The model exhibits overfitting: high training accuracy but poor test accuracy. L1 (Lasso) or L2 (Ridge) regularization penalizes large coefficients, reducing model complexity and improving generalization. This directly addresses the variance problem without requiring more data or features.
Exam trap
AWS often tests the distinction between overfitting and underfitting, and the trap here is that candidates may think adding more data (Option D) is the universal fix for overfitting, when in fact regularization is the most direct and efficient solution for a model with high variance.
How to eliminate wrong answers
Option A is wrong because training a deeper neural network would increase model capacity and likely worsen overfitting, not fix it. Option B is wrong because adding more features through feature engineering would increase dimensionality and exacerbate overfitting, not reduce it. Option D is wrong because increasing the training dataset size can help reduce overfitting, but it is not the most direct or practical fix; regularization is a more immediate and targeted technique for this specific symptom.