根据发布者在其中一个答案中的回复,我将重新表述问题陈述,因为它可以使用R我编写的包来解决:
任务是将一组元素划分为 K 个组,以使簇之间的距离最小化,而簇内的距离最大化。这在数学上与聚类相反,确实被称为反聚类;关于这种方法,有一些很少被引用的论文(Späth 1986;Valev 1998)。通常,反聚类会导致彼此相似的聚类。
如果你使用的是 R,你可以使用我的包 anticluster来解决 anticlustering 问题。例如,使用以下代码在经典鸢尾花数据集中创建三组相似的植物:
library(anticlust)
data(iris)
## Maximize the k-means criterion
anticlusters <- anticlustering(
iris[, -5],
K = 3,
objective = "variance"
)
## Compare feature means by anticluster
by(iris[, -5], anticlusters, function(x) round(colMeans(x), 2))
#> anticlusters: 1
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> 5.84 3.06 3.76 1.20
#> ---------------------------------------------------------------------------------------
#> anticlusters: 2
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> 5.84 3.06 3.76 1.20
#> ---------------------------------------------------------------------------------------
#> anticlusters: 3
#> Sepal.Length Sepal.Width Petal.Length Petal.Width
#> 5.84 3.06 3.76 1.20
我的包可以最大化两个聚类目标:(a)经典的 k-means 目标,导致相似的特征均值;(b) 聚类编辑目标,它是聚类内成对距离的总和。在包中,您可以objective在“方差”(k-means)或“距离”(聚类编辑)之间改变参数。
Github 页面和包文档包含有关包中使用的方法和算法的更多信息。
Späth, H. (1986)。反聚类:最大化方差标准。控制与控制论,15(2),213–218。
Valev, V. (1998)。重新审视设置分区原则。在关于模式识别 (SPR) 和结构和句法模式识别 (SSPR) 中的统计技术的联合 IAPR 国际研讨会上(第 875-881 页)。