{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $X$ be a real $n \\times p$ matrix, let $y \\in \\R^n$, and let $\\lambda \u003e 0$.\nFor $b \\in \\R^p$ write $\\norm{b}_1 = \\sum_{j=1}^p \\abs{b_j}$ and let $\\norm{\\cdot}_2$ be the Euclidean norm.\nA *lasso estimate* with parameter $\\lambda$ is a minimiser over $b \\in \\R^p$ of\n$$\\frac{1}{2} \\norm{y - X b}_2^2 + \\lambda \\norm{b}_1.$$\n\n## Remarks\n\nThe objective is [[convex|07Q7CNM5WF]] and tends to infinity as $\\norm{b}_1 \\to \\infty$, so a minimiser exists.\nIt need not be unique when the columns of $X$ are linearly dependent.\nThere is no closed formula in general; the estimate is computed by coordinate descent or by the LARS algorithm.\nAuthors scale the objective in different ways, for example with $\\frac{1}{2n}$ in front of the squared norm, which only rescales $\\lambda$.\n\nExample: assume $X^T X = I_p$ and put $z = X^T y$, the [[ordinary least squares|YM708KHV2W]] estimate.\nThen $\\norm{y - Xb}_2^2 = \\norm{z - b}_2^2 + \\text{const}$, and the problem splits into the $p$ problems of minimising $\\frac{1}{2}(z_j - b_j)^2 + \\lambda \\abs{b_j}$.\nThe solution is the soft thresholding $\\hat\\beta_j = \\sgn(z_j) \\max(\\abs{z_j} - \\lambda, 0)$.\nSo every $j$ with $\\abs{z_j} \\le \\lambda$ gets $\\hat\\beta_j = 0$.\n\nNon-example: with the squared norm $\\norm{b}_2^2$ in place of $\\norm{b}_1$, the same orthonormal case gives $\\hat\\beta_j = z_j / (1 + 2\\lambda)$, which is never $0$ when $z_j \\ne 0$; that is ridge regression, not the lasso.\n\nEquivalent form: for each $\\lambda \u003e 0$ and each lasso estimate $\\hat\\beta$, the vector $\\hat\\beta$ minimises $\\norm{y - Xb}_2^2$ under the constraint $\\norm{b}_1 \\le \\norm{\\hat\\beta}_1$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "KZ226116HW",
    "kind": "definition",
    "msc": [
      "62J07",
      "62J05"
    ],
    "name": "Lasso",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Lasso_(statistics)"
      }
    ],
    "tag": "V6XGZQ0GR1",
    "uses": [
      "YM708KHV2W",
      "0BYTQ4X1HC",
      "07Q7CNM5WF"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/V6XGZQ0GR1/",
  "links": [
    {
      "field": "defines",
      "target": "KZ226116HW"
    },
    {
      "field": "uses",
      "target": "YM708KHV2W"
    },
    {
      "field": "uses",
      "target": "0BYTQ4X1HC"
    },
    {
      "field": "uses",
      "target": "07Q7CNM5WF"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/V6XGZQ0GR1.md",
  "msc": [
    "62J07",
    "62J05"
  ],
  "name": "Lasso",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/V6X/V6XGZQ0GR1.md",
  "status": null,
  "tag": "V6XGZQ0GR1",
  "uri": "m2://V6XGZQ0GR1",
  "url": "https://tamnd.github.io/math2/wiki/lasso-definition/",
  "writing": {
    "tag": "V6XGZQ0GR1",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
