使用 R 中的 apcluster 包,可以 "score" 未聚类的数据点

using the apcluster package in R, it is possible to "score" unclustered data points

我是 R 的新手,我有一个我不确定是否可行的请求。我们有许多零售点,我的老板希望使用亲和力传播将其分组到集群中。我们不会根据地理位置进行聚类。一旦他找到了他喜欢的配置,他希望能够输入其他位置以确定它们应该属于那些设置的集群中的哪一个。

我能想到的唯一解决方案是使用相同的选项并使用原始点和添加的新点重新聚类,但是我相信这可能会改变结果。

我理解的对吗,还是有其他选择?

集群不是drop-in class化的替代品。

很少有聚类算法可以有意义地整合新信息。

然而,解决您的问题的常用方法很简单:

  1. 进行聚类。
  2. 使用集群标签作为 class 标签
  3. 训练一个class合成器
  4. 将 classifier 应用于新数据

抱歉回答晚了,我只是偶然发现了你的问题。

同意Anony-Mousse的回答,聚类是第一步,分类是第二步。但是,我不确定这是否是这里的最佳选择。 Elena601b 显然是在谈论具有真正空间数据的任务,所以我的印象是最好的方法是先聚类,然后通过寻找最接近的聚类范例 "classify" new points/samples/locations。这是合成数据的一些代码:

## if not available, run the following first:
## install.packages("apcluster")

library(apcluster)

## create four synthetic 2D clusters
cl1 <- cbind(rnorm(30, 0.3, 0.05), rnorm(30, 0.7, 0.04))
cl2 <- cbind(rnorm(30, 0.7, 0.04), rnorm(30, 0.4, .05))
cl3 <- cbind(rnorm(20, 0.50, 0.03), rnorm(20, 0.72, 0.03))
cl4 <- cbind(rnorm(25, 0.50, 0.03), rnorm(25, 0.42, 0.04))
x <- rbind(cl1, cl2, cl3, cl4)

## run apcluster() (you may replace the Euclidean distance by a different
## distance, e.g. driving distance, driving time)
apres <- apcluster(negDistMat(r=2), x, q=0)

## create new samples
xNew <- cbind(rnorm(10, 0.3, 0.05), rnorm(10, 0.7, 0.04))

## auxiliary predict() function
predict.apcluster <- function(s, exemplars, newdata)
{
    simMat <- s(rbind(exemplars, newdata),
                sel=(1:nrow(newdata)) + nrow(exemplars))[1:nrow(exemplars), ]
    unname(apply(simMat, 2, which.max))
}

## assign new data samples to exemplars
predict.apcluster(negDistMat(r=2), x[apres@exemplars, ], xNew)

## ... the result is a vector of indices to which exemplar/cluster each
## data sample is assigned

我可能会在以后的包发布中添加这样一个predict()方法(我是包的维护者)。希望对您有所帮助。