{
  "aliases": null,
  "backlinks": [
    {
      "field": "defines",
      "target": "PNF97STBAW"
    }
  ],
  "body": "\n## Summary\n\n$k$-means clustering splits points of $\\R^d$ into $k$ groups.\nIt makes the sum of squared distances from each point to the mean of its group as small as possible.\nIt is one of the most widely used methods of [[cluster analysis|D9Y3A9RH6J]].\nFinding the exact optimum is computationally hard in general, so it is approximated by Lloyd's algorithm, which alternates between assigning points and updating means.\nThe method works best for compact, roughly round clusters of similar size.\n\n## Explanations\n\n### L1 human\n\nChoose $k$ starting centres.\nGive each point to its nearest centre, then move each centre to the average of the points it received.\nRepeat until nothing changes.\nFor the points $0, 1, 10, 11$, $k = 2$ and the starting centres $0$ and $1$, the method ends with the groups $\\set{0, 1}$ and $\\set{10, 11}$, with centres $0.5$ and $10.5$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "kind": "concept",
    "msc": [
      "62H30"
    ],
    "name": "k-means clustering",
    "same_as": {
      "wikidata": "Q310401",
      "wikipedia": "K-means clustering"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/K-means_clustering"
      }
    ],
    "specializes": [
      "D9Y3A9RH6J"
    ],
    "tag": "D5PN3G41D6"
  },
  "kind": "concept",
  "link": "https://tamnd.github.io/math2/node/D5PN3G41D6/",
  "links": [
    {
      "field": "specializes",
      "target": "D9Y3A9RH6J"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/D5PN3G41D6.md",
  "msc": [
    "62H30"
  ],
  "name": "k-means clustering",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/D5P/D5PN3G41D6.md",
  "status": null,
  "tag": "D5PN3G41D6",
  "uri": "m2://D5PN3G41D6",
  "url": "https://tamnd.github.io/math2/wiki/k-means-clustering/",
  "writing": {
    "tag": "D5PN3G41D6",
    "kind": "concept",
    "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
      }
    ]
  }
}
