{
  "schema": "ml-prep/item@1",
  "item": {
    "id": "original-ml-regularization",
    "area": "machine-learning",
    "topic": "optimization",
    "origin": "original",
    "title": "L1 versus L2 regularization",
    "skills": [
      "regularization",
      "objective-functions",
      "model-complexity",
      "generalization"
    ],
    "priority": "core",
    "difficulty": "easy",
    "estimated_minutes": 6,
    "prerequisites": [
      "norms"
    ],
    "prompt": "Compare $L_1$ and $L_2$ regularization in geometry, differentiability at zero, and typical coefficient behavior. State one reason regularization can improve validation performance while worsening training loss.\n",
    "answer": "$L_1$ uses $\\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. $L_2$ uses $\\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.\n",
    "check": {
      "kind": "symbolic",
      "id": "original-ml-regularization",
      "values": [
        1
      ]
    }
  }
}