βˆ‘GateAndNet
PlannerSign Up
INTERMEDIATEFrequently Tested 4 min read 11 views

Machine Learning: Bias-Variance, L1/L2 Regularization & Confusion Matrix Metrics

Expected test MSE decomposition, why L1 Lasso induces sparsity while L2 Ridge shrinks smoothly, Precision/Recall/F1 & PCA.

Ridge (L2L_2) vs. Lasso (L1L_1) Regularization

  • Ridge Regression (L2L_2 penalty Ξ»βˆ₯wβˆ₯22\lambda \|w\|_2^2): Closed-form solution w^ridge=(XTX+Ξ»I)βˆ’1XTy\hat{w}_{\text{ridge}} = (X^T X + \lambda I)^{-1} X^T y. Always invertible for Ξ»>0\lambda > 0 even when XTXX^T X is singular (collinearity)! Shrinks weights toward zero asymptotically without setting them to exact zero.
  • Lasso Regression (L1L_1 penalty Ξ»βˆ₯wβˆ₯1\lambda \|w\|_1): Diamond-shaped constraint polytope has sharp corners on coordinate axes β€…β€ŠβŸΉβ€…β€Š\implies drives irrelevant feature weights to exact 00 (automatic Feature Selection!).
Key Formulas Summary
Expected Squared Test Error Decomposition
E[(yβˆ’f^(x))2]=Bias⁑(f^(x))2+Var⁑(f^(x))+σϡ2\mathbb{E}\big[(y - \hat{f}(x))^2\big] = \operatorname{Bias}(\hat{f}(x))^2 + \operatorname{Var}(\hat{f}(x)) + \sigma_{\epsilon}^2
Note: Irreducible noise sigma^2 cannot be beaten by any model
F1-Score (Harmonic Mean of Precision & Recall)
F1=2β‹…Precisionβ‹…RecallPrecision+Recall=2 TP2 TP+FP+FNF_1 = \frac{2 \cdot \text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}} = \frac{2\,\text{TP}}{2\,\text{TP} + \text{FP} + \text{FN}}
Note: TPR (Recall) = TP/(TP+FN); FPR = FP/(FP+TN) for ROC curve
#GATE DA#Machine Learning#Lasso#Ridge#PCA

Practice Questions on This Chapter (2)

Q1GATE DA 2024MCQMEDIUM
+2M β€’ -0.67

In a binary classification task, a model achieves Precision=0.80\text{Precision} = 0.80 and Recall=0.50\text{Recall} = 0.50. What is the F1F_1-score of the classifier (rounded to two decimal places)?

⚑ Click an option above to verify instantly
Q2GATE DA MSQMSQMEDIUM
+2M β€’ 0 Neg

Which of the following statements regarding Regularization and Ensemble Learning are TRUE?

β˜‘οΈ Multiple Select Question β€” pick one or more options, then click Check Answer.
Previous TopicA/B Testing Power Analysis, Simpson’s Paradox & Correlation vs Causality TrapsNext Topic Support Vector Machines (SVM): Margin Duality, KKT Conditions & Kernel Trick