【发布时间】:2017-08-14 19:40:41
【问题描述】:
我使用 Kaufman 和 Rousseeuw 的 CLARA algorithm 在 R 中对具有 N > 8*10^6 的大型数据集进行聚类。算法本身的实现允许用户通过以下方式控制执行时间例如将样本大小限制为 n=100。
然而,R 中plot() 函数的使用似乎包括了绘图中的所有数据对象,这导致了非常长的处理时间和非常拥挤的绘图(请参阅下面的可重现示例)。
理论上应该可以只从CLARA而不是N绘制最佳样本。是否有针对此的实现或如何解决此问题?
## generate 2.5 mio objects, divided into 2 clusters.
x <- rbind(cbind(rnorm(10^6,0,0.5), rnorm(10^6,0,0.5)),
cbind(rnorm(1.5*10^6,5,0.5), rnorm(1.5*10^6,5,0.5)))
library("cluster")
# get clusters solution
clara.x<-clara(x,k=2,sampsize = 100)
# see medoids
clara.x$medoids
# plot the cluster solution
plot(clara.x) # takes long time. creates crowded plot
clusplot(clara.x) # did not finish
【问题讨论】:
标签: r plot cluster-analysis large-data