解读 K-means 聚类

R 中的聚类分析

Dmitriy (Dima) Gorenshteyn

Lead Data Scientist, Memorial Sloan Kettering Cancer Center

批发数据集

  • 45 条观测
  • 3 个特征:
    • 牛奶支出
    • 杂货支出
    • 冷冻食品支出
print(customers_spend)
    Milk Grocery Frozen
1  11103   12469    902
2   2013    6550    909
3   1897    5234    417
4   1304    3643   3045
5   3199    6986   1455
...  ...     ...    ...
R 中的聚类分析

用层次聚类分群

R 中的聚类分析

用层次聚类分群

cluster Milk Grocery Frozen cluster size
1 16950 12891 991 5
2 2512 5228 1795 29
3 10452 22550 1354 5
4 1249 3916 10888 6
R 中的聚类分析

用 K-means 分群

  • 用平均轮廓系数估计"最佳" k
  • 按建议的 k 运行 k-means
  • 描述这些客户簇的消费习惯
R 中的聚类分析

开始聚类!

R 中的聚类分析

Preparing Video For Download...