以下混合变量数据的 KMeans 聚类

KMeans clustering for the following mixed variable data

有人可以帮我解决这个问题吗?

我正在学习 KMeans 聚类概念。如果变量是连续的,我知道如何聚类。但是此数据集包含 categorical/discrete 个变量,例如性别和邮政编码。

Sno Age Gender Zip  Salary
1   26  0   9822    100
2   38  1   9822    700
3   19  1   9822    100
4   64  0   9810    2500    
5   53  1   9810    1200
6   75  1   9810    1800
7   19  0   9822    75
8   36  1   9822    350
9   42  1   9875    1800
10  41  0   9875    750

K-Means 仅适用于数值数据。

K-means 对分类数据失败,因为取分类数据的平均值根本没有意义。距离也不行。有些人 运行 K-means 上的数据使用一种热编码。但这也没有给出正确的集群。

要解决此类问题,您可以查看 K-Means 的另一种变体,称为 K-Prototype 算法,它适用于混合分类数据和数值数据。

查看 https://pypi.python.org/pypi/kmodes/

此 link 包含使用此算法的论文和 python 包。也很容易理解。