R kmeans初始化

R kmeans初始化,第1张

R kmeans初始化

是。您提到的实现允许您指定起始位置。您通过

centers
参数传递它们

> dat <- data.frame(x = rnorm(99, mean = c(-5, 0 , 5)), y = rnorm(99, mean = c(-5, 0, 5)))> plot(dat)> start <- matrix(c(-5, 0, 5, -5, 0, 5), 3, 2)> kmeans(dat, start)K-means clustering with 3 clusters of sizes 33, 33, 33Cluster means:xy1 -5.0222798 -5.065456892 -0.1297747 -0.028902043  4.8006581  5.00315151Clustering vector: [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2[51] 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3Within cluster sum of squares by cluster:[1] 58.05137 73.81878 52.45732 (between_SS / total_SS =  94.7 %)Available components:[1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss" "betweenss"   [7] "size"


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5652283.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存