1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 2

CAB212 · Unit 2: Regression

Regularization: ridge, lasso and elastic net

8 practice questions

Key points

  • Ridge = L2, lasso = L1
  • Lasso can zero out weights
  • Larger lambda: more bias, less variance
  • Standardize features first

Regularization adds a penalty on weight size to the loss to reduce overfitting.

MethodPenaltyEffect
Ridge (L2)lambda * sum(w^2)Shrinks weights toward zero, rarely exactly zero
Lasso (L1)lambda * sum(|w|)Drives some weights to exactly zero (feature selection)
Elastic netMix of L1 and L2Handles correlated features; keeps sparsity

The hyperparameter lambda (alpha in scikit-learn) sets strength: lambda = 0 gives plain OLS; large lambda shrinks weights heavily (more bias, less variance).

The intercept is normally not penalized. Features should be standardized first because penalties depend on weight scale.

Exam pitfall: lasso produces sparse models; ridge does not.

Try two questions

Question 1 · Tier 3, Apply

Lasso is useful for automatic:

  1. Data splitting
  2. Feature selection
  3. Label encoding
  4. Image resizing
Show the answer

B. Zeroed weights drop features.

Question 2 · Tier 1, Recall

The ridge penalty is proportional to:

  1. The number of samples
  2. The sum of absolute weights
  3. The sum of squared weights
  4. The product of weights
Show the answer

C. Ridge is L2 regularization.