1. 程式人生 > >機器學習筆記 ---- K-Means Algorithm

機器學習筆記 ---- K-Means Algorithm

1. K-Means Algorithm

  • Randomly choose x points as centroids, i-th is μ
    i
  • Divide all points into x groups by determining the minimum distance they have from all
    x
    centroids
  • Change the centroids into the average of each groups
  • Repeat until all centroids do not change

2. Obtimization Objective of K-Means

Let c

( i ) denote the group i-th point belongs to, then our task is

m i n c , μ J ( c , μ ) = ( x ( i ) μ c ( i ) ) 2

3. Random Initialization


Randomly pick k examples in which k is the number of centroids
May be stuck in local optima: Init and Run K-Means for many times, pick the solution with lowest J

4. Choose the Number of Clusters


Elbow method / Depending on later purpose