Back to AI Math Mind Map
中文·English
📐 AI MathID: regularization-geometry

Regularization Geometry

L1/L2 正则化几何
🎯Core Definition
Regularization is equivalent to adding a penalty or constraining the solution: minwL(w)\min_w L(w) s.t. wpt\Vert w\Vert_p \le t. L2 (ridge): penalty λ2w22\frac{\lambda}{2}\Vert w\Vert_2^2, the constraint set is a ball; the loss contours (data-determined ellipses) touch the sphere at a point where all coordinates are uniformly shrunk but generally nonzero. Closed form: w=(XTX+λI)1XTyw^* = (X^TX + \lambda I)^{-1}X^Ty; via SVD X=UΣVTX = U\Sigma V^T this becomes w=V(ΣTΣ+λI)1ΣTUTyw^* = V(\Sigma^T\Sigma + \lambda I)^{-1}\Sigma^TU^Ty, i.e. each eigen-direction is scaled by σi2σi2+λ\frac{\sigma_i^2}{\sigma_i^2 + \lambda} — directions with small singular values are shrunk most, and XTX+λIX^TX + \lambda I is always invertible. L1 (lasso): the constraint set w1t\Vert w\Vert_1 \le t is a diamond (hypercube in higher dims) whose vertices lie exactly on the coordinate axes; the loss ellipse often touches the diamond at a vertex or edge → some coordinates are exactly zero → sparse solutions.
💡Use Cases
high-dimensional feature selection (L1), stabilizing ill-conditioned/collinear XTXX^TX inversion (L2), and interview questions on why L1 gives sparse solutions (geometric and Bayesian views).
Key Problems Solved
in the Bayesian view, regularization is MAP with a prior. L2 corresponds to a Gaussian prior wN(0,τ2I)w \sim \mathcal{N}(0, \tau^2 I) with λ=σ2/τ2\lambda = \sigma^2/\tau^2: w^MAP=argmaxw12σ2yXw212τ2w2\hat w_{MAP} = \arg\max_w -\frac{1}{2\sigma^2}\Vert y - Xw\Vert^2 - \frac{1}{2\tau^2}\Vert w\Vert^2 — the smooth Gaussian tail shrinks all weights but keeps them nonzero. L1 corresponds to a Laplace prior p(w)eλwp(w) \propto e^{-\lambda|w|}, whose density has a sharp peak at 0 concentrating probability mass near zero → the posterior mode pushes weights to exactly 0. Regularization reduces variance (fights overfitting) and makes the solution unique, at the cost of introducing bias.
🎯5 High-Frequency Exam Points
1
Draw the L1 diamond and L2 ball; explain why contour tangency at diamond vertices yields sparse solutions while ball tangencies are generically off-axis.
2
Derive the ridge closed form w=(XTX+λI)1XTyw = (X^TX+\lambda I)^{-1}X^Ty and use SVD to analyze the per-direction shrinkage σi2/(σi2+λ)\sigma_i^2/(\sigma_i^2+\lambda).
3
Bayesian view: write the log-posterior under Gaussian/Laplace priors and show L2 = Gaussian-prior MAP, L1 = Laplace-prior MAP.
4
Why can L1 land exactly on non-differentiable corners? Write and explain the lasso subgradient condition 0XT(Xwy)+λw10 \in X^T(Xw-y) + \lambda\partial\Vert w\Vert_1.
5
How does the regularization strength λ\lambda trade off bias vs variance? Why is regularization described as trading bias for variance?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Regularization Geometry"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardNewton's MethodNext CardBias-Variance Decomposition

🔗 More AI Math Knowledge Cards

Adam/AdamW MathBayesian InferenceBootstrapCausal Inference (Rubin)