K-means 简介

R 中的聚类分析

Dmitriy (Dima) Gorenshteyn

Lead Data Scientist, Memorial Sloan Kettering Cancer Center

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

R 中的聚类分析

kmeans()

print(lineup)
       x     y
 1    -1     1
 2    -2    -3
 3     8     6
 4     7    -8
 ...  ...   ...
model <- kmeans(lineup, centers = 2)
R 中的聚类分析

分配聚类

print(model$cluster)
1 1 2 2 1 1 1 2 2 2 1 2
lineup_clustered <- mutate(lineup, cluster = model$cluster)
print(lineup_clustered)
       x     y cluster
   <dbl> <dbl>   <int>
 1    -1     1       1
 2    -2    -3       1
 3     8     6       2
 4     7    -8       2
 ...  ...  ...     ...
R 中的聚类分析

让我们练习!

R 中的聚类分析

Preparing Video For Download...