Skip to content

Week 7 Lecture 1.5

Clustering

  • Categorizing elements by a notion of similarity.
  • We have no labels, the training will be unsuperwised
  • Categories emerge from the similarity criteria
  • good for _ around and _ out

K-means problem

  • Finding the center point for each category (clusters)
πœ™(𝒳︀,𝐢)β‰”βˆ‘π‘₯βˆˆπ’³οΈ€minπ‘βˆˆπΆβ€–π‘₯βˆ’π‘β€–22

.2 is for the Euclidian distance.

is defined as the sum of (squared) distances between every point and their nearest point in 𝐢

The problem itself is to find the two sets that minimizes the πœ™ function.
  • Elements in 𝐢 may not be elements of 𝒳︀
  • The problem itself is NP-hard (even the approximation)
  • we will treat the special case of π‘˜=1

min𝐢={𝑐}βˆˆβ„π‘šβˆ‘π‘₯βˆˆπ’³οΈ€β€–π‘₯βˆ’π‘β€–22

solved when 𝑐=1|𝒳︀|βˆ‘π‘₯βˆˆπ’³οΈ€π‘₯ called a centroid (stands for center of mass geometrically speaking)

k-means algorithm

  • Place random centerpoints to form the first clusters
  • Re-calculate the center point to better fit that one partition. (doesn’t need to be globally correct)
  • Rinse and repeat
  • Should converge in finite iterations

    • … to a locally optimal clustering

Notes from Sadegh:

  • Simple, and relatively efficient*
  • Fast convergence in practice
  • needs π‘˜
  • local optimum can be really bad
  • outliers and heuristics matters a lot

seeding methods: k-means++

Common remedies for the root problems of k-means:

  • run it multiple times, select the best

algorithm

  • Place each starting point one-by-one:

    • Starting point is selected from the data at random
    • Each point has the probability of being selected equal to the distance from the closest center point
  • Run the original k-means with this setup