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"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)