MLS-C01 Question 187
Select 2You are developing a machine learning model using Amazon SageMaker, and you notice that your model is overfitting the training data. To address this, you decide to implement L2 regularization. Which of the following changes will correctly apply L2 regularization in your model training process?
- A
Add a penalty term to the loss function proportional to the square of the weights.
- B
Reduce the size of the training dataset to focus on fewer examples.
- C
Increase the regularization parameter lambda in the algorithm’s configuration.
- D
Use Lasso regression to apply L1 regularization instead.
- E
Implement dropout layers in a neural network to randomly drop connections.
Show answer and explanation
Correct answers: A, C
Explanation
L2 regularization works by adding a penalty term to the loss function, which is proportional to the square of the weights. This discourages large weights and helps prevent overfitting. Increasing the regularization parameter lambda amplifies the impact of this penalty, further controlling model complexity. Other options, such as L1 regularization or dropout, are alternative techniques but are not L2 regularization.
- A. Correct.
Adding a penalty term proportional to the square of the weights is the essence of L2 regularization. This helps control overfitting by discouraging overly large weights.
- B. Incorrect.
Reducing the training dataset would likely exacerbate overfitting, as the model would have even fewer examples to generalize from.
- C. Correct.
Increasing the regularization parameter lambda increases the impact of the penalty term, which helps in controlling overfitting by further constraining the weights.
- D. Incorrect.
Lasso regression applies L1 regularization, which penalizes the absolute values of weights, not their squares. While it can also help with overfitting, it is not L2 regularization.
- E. Incorrect.
Dropout is a separate technique used in neural networks to reduce overfitting by randomly dropping connections during training. It is not related to L2 regularization.