L1 versus L2 regularization

Problem

Compare L1L_1 and L2L_2 regularization in geometry, differentiability at zero, and typical coefficient behavior. State one reason regularization can improve validation performance while worsening training loss.

Reveal answer or reference solution

L1L_1 uses w1\lVert\mathbf{w}\rVert_1; its constraint region is diamond-shaped (a cross-polytope) with axis-aligned corners. It is nondifferentiable when a coefficient is zero and often yields exact sparsity. L2L_2 uses w22\lVert\mathbf{w}\rVert_2^2; its constraint region is round, it is differentiable everywhere, and it smoothly shrinks coefficients without usually making them exactly zero. Either penalty can increase unregularized training loss while reducing effective complexity, variance, and overfitting, thereby improving validation performance.

Local history

Loading attempts saved in this browser…

Use with your agent

Share this URL and your attempt. Ask the agent to start with a clarifying question or the smallest useful hint.

Tutor me on https://mlprep.iwase.dev/machine-learning/optimization/original-ml-regularization/. If window.mlPrepAgent is available, read attempts for item original-ml-regularization before tutoring. Inspect my attempt, keep the item ID, and do not reveal the full answer first. After a real attempt, append its record and read it back.

Appears in