R version 3.3.0 beta (2016-04-13 r70476) -- "Supposedly Educational" Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(cluster) > > ## generate 1500 objects, divided into 2 clusters. > if(R.version$major != "1" || as.numeric(R.version$minor) >= 7) RNGversion("1.6") Warning message: In RNGkind("Marsaglia-Multicarry", "Buggy Kinderman-Ramage") : buggy version of Kinderman-Ramage generator used > set.seed(264) > x <- rbind(cbind(rnorm(700, 0,8), rnorm(700, 0,8)), + cbind(rnorm(800,50,8), rnorm(800,10,8))) > > isEq <- function(x,y, epsF = 100) + is.logical(r <- all.equal(x,y, tol = epsF * .Machine$double.eps)) && r > > .proctime00 <- proc.time() > > ## full size sample {should be = pam()}: > n0 <- length(iSml <- c(1:70, 701:720)) > summary(clara0 <- clara(x[iSml,], k = 2, sampsize = n0)) Object of class 'clara' from call: clara(x = x[iSml, ], k = 2, sampsize = n0) Medoids: [,1] [,2] [1,] 1.619094 -0.6697098 [2,] 51.460664 12.6328215 Objective function: 9.351248 Numerical information per cluster: size max_diss av_diss isolation [1,] 70 23.67426 9.295059 0.4589260 [2,] 20 19.81041 9.547913 0.3840251 Average silhouette width per cluster: [1] 0.7419559 0.7295666 Average silhouette width of best sample: 0.7392027 Best sample: [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [76] 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 [77] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Silhouette plot information for best sample: cluster neighbor sil_width 40 1 2 0.8189217 70 1 2 0.8186973 66 1 2 0.8173129 39 1 2 0.8171253 6 1 2 0.8158260 9 1 2 0.8147047 12 1 2 0.8133175 26 1 2 0.8128297 56 1 2 0.8117376 7 1 2 0.8095740 33 1 2 0.8092035 60 1 2 0.8067630 62 1 2 0.8059430 21 1 2 0.8030279 41 1 2 0.8017783 16 1 2 0.8005143 27 1 2 0.7971827 59 1 2 0.7968887 8 1 2 0.7947941 17 1 2 0.7941256 38 1 2 0.7934237 32 1 2 0.7920043 63 1 2 0.7901349 52 1 2 0.7872858 46 1 2 0.7852065 47 1 2 0.7842709 65 1 2 0.7839258 4 1 2 0.7809115 23 1 2 0.7799612 19 1 2 0.7786651 42 1 2 0.7780707 20 1 2 0.7768930 37 1 2 0.7719716 11 1 2 0.7719447 22 1 2 0.7698024 30 1 2 0.7685122 68 1 2 0.7634484 1 1 2 0.7624047 58 1 2 0.7613915 50 1 2 0.7567549 25 1 2 0.7468130 31 1 2 0.7437604 2 1 2 0.7423751 15 1 2 0.7342193 69 1 2 0.7315055 36 1 2 0.7312177 48 1 2 0.7293586 14 1 2 0.7222345 3 1 2 0.7209803 44 1 2 0.7169812 34 1 2 0.7147437 64 1 2 0.7129325 54 1 2 0.7089811 49 1 2 0.7044900 43 1 2 0.6884306 29 1 2 0.6845792 10 1 2 0.6813561 51 1 2 0.6730410 13 1 2 0.6685180 55 1 2 0.6680502 5 1 2 0.6518400 35 1 2 0.6506280 24 1 2 0.6343832 18 1 2 0.6176214 61 1 2 0.6027746 57 1 2 0.5944097 45 1 2 0.5878055 53 1 2 0.5668748 28 1 2 0.5615843 67 1 2 0.5471711 82 2 1 0.8130494 84 2 1 0.8120131 90 2 1 0.8004220 73 2 1 0.7992194 78 2 1 0.7895616 76 2 1 0.7859463 89 2 1 0.7832719 88 2 1 0.7820209 83 2 1 0.7599199 80 2 1 0.7570550 87 2 1 0.7435898 71 2 1 0.7339466 75 2 1 0.7210982 81 2 1 0.7177946 72 2 1 0.7137692 86 2 1 0.7045675 79 2 1 0.7003733 85 2 1 0.6854539 74 2 1 0.4973579 77 2 1 0.4909004 4005 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.37429 10.21900 18.31000 26.97500 46.50100 81.38000 Metric : euclidean Number of objects : 90 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > pam0 <- pam (x[iSml,], k = 2) > stopifnot(identical(clara0$clustering, pam0$clustering) + , isEq(clara0$objective, unname(pam0$objective[2])) + ) > > summary(clara2 <- clara(x, 2)) Object of class 'clara' from call: clara(x = x, k = 2) Medoids: [,1] [,2] [1,] 2.787896 0.06403649 [2,] 51.594304 8.52944737 Objective function: 10.15876 Numerical information per cluster: size max_diss av_diss isolation [1,] 700 32.70228 10.378867 0.6601837 [2,] 800 27.37593 9.966161 0.5526569 Average silhouette width per cluster: [1] 0.752770 0.772374 Average silhouette width of best sample: 0.7652453 Best sample: [1] 21 50 97 142 168 191 192 197 224 325 328 408 433 458 471 [16] 651 712 714 722 797 805 837 909 919 926 999 1006 1018 1019 1049 [31] 1081 1084 1132 1144 1150 1201 1207 1291 1307 1317 1330 1374 1426 1428 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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843 97 1 2 0.8061654 433 1 2 0.7948877 191 1 2 0.7761169 50 1 2 0.7689566 651 1 2 0.7664647 192 1 2 0.7439787 325 1 2 0.7187212 471 1 2 0.7138665 168 1 2 0.6506124 224 1 2 0.6364204 328 1 2 0.5940982 919 2 1 0.8392739 1307 2 1 0.8360310 1081 2 1 0.8358883 1132 2 1 0.8313630 1207 2 1 0.8297462 712 2 1 0.8252963 1428 2 1 0.8194915 1150 2 1 0.8173306 1006 2 1 0.8163528 1144 2 1 0.8130290 1317 2 1 0.8128990 714 2 1 0.8127996 797 2 1 0.8103648 999 2 1 0.8090429 722 2 1 0.7873873 1019 2 1 0.7834898 1374 2 1 0.7830414 1426 2 1 0.7719712 1049 2 1 0.7695327 1201 2 1 0.7612259 1330 2 1 0.7542818 909 2 1 0.7342792 1291 2 1 0.7308119 837 2 1 0.6919267 1084 2 1 0.6774914 926 2 1 0.6713276 805 2 1 0.6304831 1018 2 1 0.5703118 946 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.43881 11.27700 26.16100 32.88500 53.08100 94.22300 Metric : euclidean Number of objects : 44 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > clInd <- c("objective", "i.med", "medoids", "clusinfo") > clInS <- c(clInd, "sample") > ## clara() {as original code} always draws the *same* random samples !!!! > clara(x, 2, samples = 50)[clInd] $objective [1] 10.00144 $i.med [1] 551 1232 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 49.4297134 9.5070656 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6210615 [2,] 800 27.03542 9.887517 0.5462269 > > ## The for() code below *did* hang (in some 64-bit versions of R / clara / ...): > ## but this has been fixed *long* ago > xx <- x[sample(nrow(x)),] > if(FALSE) { ## only run manually + ff <- "/u/maechler/R/MM/Pkg-ex/cluster/clara2-ex.rda" + if(file.exists(ff)) + load(ff) + else + save(xx, file=ff, compress=TRUE) + } > print(clara(xx, 2, samples= 5, trace = 3)[clInd]) C clara(): (nsam,nran,n) = (44,5,1500); C clara(): sample 1 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 23 {295} [ntt=44, nunfs=0] .. nsel[1:44]= 23 54 87 103 140 199 246 303 306 322 394 408 412 414 428 461 468 521 592 647 859 898 906 967 971 1007 1028 1039 1114 1149 1151 1192 1237 1250 1279 1291 1301 1317 1340 1353 1366 1381 1383 1492 -> dysta2() . clara(): s:= max dys[1..946] = 84.7454; clara()'s bswap2(*, s=84.7454): new repr. 6 new repr. 31 after build: medoids are 6 31 and min.dist dysma[1:n] are 17.5 3.72 16.2 15.6 7.76 0 6.93 13.7 13.9 18.2 9.47 14.9 12.5 4.77 9.89 8.22 6.83 9.29 13.9 21.5 7.68 16.1 7.31 13.1 9.95 21.7 17.8 13.1 15.7 25.3 0 20.5 4.36 14.4 20.5 4.1 20.5 9.65 10.5 9.98 10.2 15.4 7.81 16 --> sky = sum_j D_j= 536.37 swp new 39 <-> 6 old; decreasing diss. by -117.879 Last swap: new 39 <-> 6 old; decreasing diss. by 1 end{bswap2}: sky = 418.491 1st proper or new best: obj= 10.112 C clara(): sample 2 if (kall && nunfs...): .. kall: T, ... nrx [0:1]= 1151 1340 ... nsel[0:1]= 1151 1340 {295} [ntt=44, nunfs=0] .. nsel[1:44]= 21 50 97 142 168 191 192 197 224 325 328 433 458 471 651 712 714 722 797 805 837 909 919 926 999 1006 1018 1019 1049 1081 1084 1132 1144 1150 1151 1201 1207 1291 1307 1330 1340 1374 1426 1428 -> dysta2() . clara(): s:= max dys[1..946] = 80.3603; clara()'s bswap2(*, s=80.3603): new repr. 18 new repr. 35 after build: medoids are 18 35 and min.dist dysma[1:n] are 12.1 6.02 9.26 27.3 9.32 11.1 8.81 1.82 23.9 8.37 8.58 8.99 4.92 14.3 34 4.75 22.7 0 14.6 7.54 13.1 23.4 25.8 13.5 6.84 11.7 14 15.6 14.6 23.5 26.1 3.81 5.7 34.1 0 8.86 24 11.4 14.7 25.6 16.5 4.76 11.4 14 --> sky = sum_j D_j= 601.537 swp new 41 <-> 18 old; decreasing diss. by -156.926 Last swap: new 41 <-> 18 old; decreasing diss. by 1 end{bswap2}: sky = 444.611 obj= 10.112 C clara(): sample 3 if (kall && nunfs...): .. kall: T, ... nrx [0:1]= 1151 1340 ... nsel[0:1]= 1151 1340 {295} [ntt=44, nunfs=0] .. nsel[1:44]= 10 15 23 46 85 90 94 105 112 225 278 313 485 486 502 513 529 639 641 660 681 757 796 812 814 865 876 896 954 959 973 1032 1045 1151 1249 1264 1269 1273 1296 1297 1336 1340 1361 1399 -> dysta2() . clara(): s:= max dys[1..946] = 90.5529; clara()'s bswap2(*, s=90.5529): new repr. 9 new repr. 5 after build: medoids are 5 9 and min.dist dysma[1:n] are 5.14 5.51 9.38 22.1 0 28.5 22.1 10.7 0 15.4 10.8 20.6 11.9 10.8 5.96 11.4 11.5 9.89 6.62 7.88 17.2 2.97 8.27 4.68 13.8 5.87 20.7 17.2 22.2 2.43 11.9 4.99 7.87 7.02 10.1 16.5 23.2 4.28 21 1.67 5.15 1.78 22.6 11.2 --> sky = sum_j D_j= 490.874 swp new 14 <-> 9 old; decreasing diss. by -82.2855 Last swap: new 14 <-> 9 old; decreasing diss. by 1 end{bswap2}: sky = 408.588 obj= 10.4392 C clara(): sample 4 if (kall && nunfs...): .. kall: T, ... nrx [0:1]= 1151 1340 ... nsel[0:1]= 1151 1340 {295} [ntt=44, nunfs=0] .. nsel[1:44]= 17 46 61 152 201 223 254 263 268 291 313 331 479 508 528 542 543 601 655 681 746 778 792 888 951 957 1010 1081 1085 1105 1110 1122 1136 1151 1231 1265 1272 1307 1340 1342 1365 1393 1395 1467 -> dysta2() . clara(): s:= max dys[1..946] = 88.047; clara()'s bswap2(*, s=88.047): new repr. 24 new repr. 18 after build: medoids are 18 24 and min.dist dysma[1:n] are 22.1 21 21 16.1 28 5.26 6.94 8.65 12 16.2 21.6 1.54 3.17 9.09 9.79 11.2 3.63 0 7.27 14.1 5.39 9.37 3.08 0 11 18.3 7.89 2.03 12.8 8.74 17.9 13.6 29.3 13.5 11.6 10.9 13.2 1.42 5.21 11.8 14.8 8.12 8.7 20.2 --> sky = sum_j D_j= 497.526 swp new 9 <-> 24 old; decreasing diss. by -109.602 Last swap: new 9 <-> 24 old; decreasing diss. by 1 end{bswap2}: sky = 387.924 obj= 10.3256 C clara(): sample 5 if (kall && nunfs...): .. kall: T, ... nrx [0:1]= 1151 1340 ... nsel[0:1]= 1151 1340 {295} [ntt=44, nunfs=0] .. nsel[1:44]= 7 38 134 140 282 283 311 329 363 461 496 539 572 585 631 655 665 695 758 792 820 823 912 919 962 1121 1140 1151 1166 1189 1192 1202 1204 1260 1297 1315 1321 1326 1340 1422 1431 1432 1463 1488 -> dysta2() . clara(): s:= max dys[1..946] = 81.3492; clara()'s bswap2(*, s=81.3492): new repr. 33 new repr. 23 after build: medoids are 23 33 and min.dist dysma[1:n] are 10.1 7.21 18.1 12.3 4.47 4.75 21.4 9.65 6.08 4.17 9.92 15.8 10.5 6.12 13.8 16.3 3.99 6.07 14.4 5.7 14.4 12.8 0 18.8 8.32 1.63 13.5 4.89 7.26 3.58 16.6 12.6 0 15.4 2.22 8.7 14.9 12.1 5.33 14 9.57 8.6 12.4 8.79 --> sky = sum_j D_j= 427.172 swp new 28 <-> 33 old; decreasing diss. by -15.2673 Last swap: new 28 <-> 33 old; decreasing diss. by 1 end{bswap2}: sky = 411.905 obj= 10.5219 C clara(): best sample _found_ ; nbest[1:44] = c(23,54,87,103,140,199,246,303,306,322,394,408,412,414,428,461,468,521,592,647,859,898,906,967,971,1007,1028,1039,1114,1149,1151,1192,1237,1250,1279,1291,1301,1317,1340,1353,1366,1381,1383,1492) --> dysta2(nbest), resul(), end $objective [1] 10.11202 $i.med [1] 1151 1340 $medoids [,1] [,2] [1,] 51.314110 7.7947054 [2,] 1.581224 0.4703763 $clusinfo size max_diss av_diss isolation [1,] 800 27.52314 10.04672 0.5475136 [2,] 700 31.46479 10.18664 0.6259242 > > print(clara(xx, 2, samples=50, trace = 2)[clInd]) C clara(): (nsam,nran,n) = (44,50,1500); C clara(): sample 1 finding 1st... new k{ran}: .. kall: FALSE, nsel[ntt=1] = 0 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 84.7454; bswap2(): 6 31 after build: medoids are 6 31 --> sky = sum_j D_j= 536.37 Last swap: new 39 <-> 6 old; decreasing diss. by 1 end{bswap2}: sky = 418.491 1st proper or new best: obj= 10.112 C clara(): sample 2 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 87 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 80.3603; bswap2(): 18 35 after build: medoids are 18 35 --> sky = sum_j D_j= 601.537 Last swap: new 41 <-> 18 old; decreasing diss. by 1 end{bswap2}: sky = 444.611 obj= 10.112 C clara(): sample 3 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 97 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 90.5529; bswap2(): 9 5 after build: medoids are 5 9 --> sky = sum_j D_j= 490.874 Last swap: new 14 <-> 9 old; decreasing diss. by 1 end{bswap2}: sky = 408.588 obj= 10.4392 C clara(): sample 4 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 23 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 88.047; bswap2(): 24 18 after build: medoids are 18 24 --> sky = sum_j D_j= 497.526 Last swap: new 9 <-> 24 old; decreasing diss. by 1 end{bswap2}: sky = 387.924 obj= 10.3256 C clara(): sample 5 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 61 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 81.3492; bswap2(): 33 23 after build: medoids are 23 33 --> sky = sum_j D_j= 427.172 Last swap: new 28 <-> 33 old; decreasing diss. by 1 end{bswap2}: sky = 411.905 obj= 10.5219 C clara(): sample 6 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 134 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 91.3227; bswap2(): 13 4 after build: medoids are 4 13 --> sky = sum_j D_j= 544.958 Last swap: new 39 <-> 4 old; decreasing diss. by 0.439251 end{bswap2}: sky = 454.919 obj= 10.1386 C clara(): sample 7 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 179 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 77.5603; bswap2(): 31 29 after build: medoids are 29 31 --> sky = sum_j D_j= 585.002 Last swap: new 36 <-> 29 old; decreasing diss. by 0.626606 end{bswap2}: sky = 448.191 obj= 10.112 C clara(): sample 8 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 45 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 86.3698; bswap2(): 12 34 after build: medoids are 12 34 --> sky = sum_j D_j= 532.479 Last swap: new 11 <-> 34 old; decreasing diss. by 0.363353 end{bswap2}: sky = 441.367 obj= 10.4095 C clara(): sample 9 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 59 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 89.6142; bswap2(): 36 7 after build: medoids are 7 36 --> sky = sum_j D_j= 666.688 Last swap: new 37 <-> 36 old; decreasing diss. by 1 end{bswap2}: sky = 401.451 obj= 10.1507 C clara(): sample 10 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 119 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 86.2865; bswap2(): 43 8 after build: medoids are 8 43 --> sky = sum_j D_j= 618.017 Last swap: new 22 <-> 8 old; decreasing diss. by 0.0544228 end{bswap2}: sky = 407.377 obj= 10.6473 C clara(): sample 11 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 93 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 84.9886; bswap2(): 17 40 after build: medoids are 17 40 --> sky = sum_j D_j= 472.932 Last swap: new 19 <-> 17 old; decreasing diss. by 1 end{bswap2}: sky = 379.676 obj= 10.5167 C clara(): sample 12 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 44 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 87.2707; bswap2(): 3 40 after build: medoids are 3 40 --> sky = sum_j D_j= 511.987 Last swap: new 12 <-> 40 old; decreasing diss. by 0.128322 end{bswap2}: sky = 393.552 1st proper or new best: obj= 10.0289 C clara(): sample 13 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 92 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 81.0553; bswap2(): 19 21 after build: medoids are 19 21 --> sky = sum_j D_j= 535.094 Last swap: new 37 <-> 21 old; decreasing diss. by 0.558058 end{bswap2}: sky = 408.043 obj= 10.0833 C clara(): sample 14 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 108 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 75.3679; bswap2(): 29 33 after build: medoids are 29 33 --> sky = sum_j D_j= 463.418 Last swap: new 14 <-> 29 old; decreasing diss. by 1 end{bswap2}: sky = 399.773 obj= 10.1145 C clara(): sample 15 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 41 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 95.135; bswap2(): 34 14 after build: medoids are 14 34 --> sky = sum_j D_j= 648 Last swap: new 37 <-> 4 old; decreasing diss. by 0.47473 end{bswap2}: sky = 437.382 obj= 10.0825 C clara(): sample 16 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 221 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 80.0027; bswap2(): 18 35 after build: medoids are 18 35 --> sky = sum_j D_j= 544.162 Last swap: new 28 <-> 15 old; decreasing diss. by 0.774928 end{bswap2}: sky = 392.466 obj= 10.6769 C clara(): sample 17 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 63 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 88.7679; bswap2(): 14 35 after build: medoids are 14 35 --> sky = sum_j D_j= 662.014 Last swap: new 13 <-> 14 old; decreasing diss. by 1 end{bswap2}: sky = 437.238 obj= 10.4843 C clara(): sample 18 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 123 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 79.4459; bswap2(): 34 36 after build: medoids are 34 36 --> sky = sum_j D_j= 448.5 Last swap: new 6 <-> 36 old; decreasing diss. by 0.756785 end{bswap2}: sky = 421.78 obj= 10.0289 C clara(): sample 19 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 135 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 88.5909; bswap2(): 10 31 after build: medoids are 10 31 --> sky = sum_j D_j= 518.807 Last swap: new 31 <-> 35 old; decreasing diss. by 0.526342 end{bswap2}: sky = 438.824 obj= 10.039 C clara(): sample 20 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 84 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 71.754; bswap2(): 37 14 after build: medoids are 14 37 --> sky = sum_j D_j= 564.583 Last swap: new 7 <-> 37 old; decreasing diss. by 1 end{bswap2}: sky = 389.759 1st proper or new best: obj= 10.0219 C clara(): sample 21 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 128 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 86.3879; bswap2(): 41 5 after build: medoids are 5 41 --> sky = sum_j D_j= 494.226 Last swap: new 11 <-> 41 old; decreasing diss. by 1 end{bswap2}: sky = 409.682 obj= 10.0219 C clara(): sample 22 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 105 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 86.2377; bswap2(): 12 11 after build: medoids are 11 12 --> sky = sum_j D_j= 504.842 Last swap: new 42 <-> 11 old; decreasing diss. by 0.951253 end{bswap2}: sky = 458.314 obj= 10.0219 C clara(): sample 23 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 204 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 89.2695; bswap2(): 36 18 after build: medoids are 18 36 --> sky = sum_j D_j= 618.515 Last swap: new 32 <-> 18 old; decreasing diss. by 0.292828 end{bswap2}: sky = 408.054 obj= 10.1029 C clara(): sample 24 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 87 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 84.5963; bswap2(): 43 2 after build: medoids are 2 43 --> sky = sum_j D_j= 604.622 Last swap: new 8 <-> 43 old; decreasing diss. by 1 end{bswap2}: sky = 420.184 obj= 10.2899 C clara(): sample 25 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 140 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 75.1447; bswap2(): 36 18 after build: medoids are 18 36 --> sky = sum_j D_j= 479.397 Last swap: new 4 <-> 18 old; decreasing diss. by 0.00150722 end{bswap2}: sky = 386.099 obj= 10.1338 C clara(): sample 26 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 273 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 83.1922; bswap2(): 25 15 after build: medoids are 15 25 --> sky = sum_j D_j= 613.595 Last swap: new 39 <-> 25 old; decreasing diss. by 1 end{bswap2}: sky = 464.068 obj= 10.2005 C clara(): sample 27 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 128 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 74.5042; bswap2(): 25 8 after build: medoids are 8 25 --> sky = sum_j D_j= 494.241 Last swap: new 16 <-> 37 old; decreasing diss. by 0.727466 end{bswap2}: sky = 396.18 1st proper or new best: obj= 10.0032 C clara(): sample 28 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 74 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 73.3263; bswap2(): 42 7 after build: medoids are 7 42 --> sky = sum_j D_j= 497.431 Last swap: new 34 <-> 42 old; decreasing diss. by 1 end{bswap2}: sky = 417.303 obj= 10.0843 C clara(): sample 29 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 95 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 85.8911; bswap2(): 16 14 after build: medoids are 14 16 --> sky = sum_j D_j= 498.138 Last swap: new 35 <-> 14 old; decreasing diss. by 0.0669929 end{bswap2}: sky = 405.979 obj= 10.2104 C clara(): sample 30 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 160 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 77.34; bswap2(): 35 14 after build: medoids are 14 35 --> sky = sum_j D_j= 495.651 Last swap: new 21 <-> 30 old; decreasing diss. by 0.969312 end{bswap2}: sky = 388.346 obj= 10.0032 C clara(): sample 31 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 45 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 79.2961; bswap2(): 44 5 after build: medoids are 5 44 --> sky = sum_j D_j= 444.394 Last swap: new 6 <-> 37 old; decreasing diss. by 0.155417 end{bswap2}: sky = 356.436 obj= 10.1346 C clara(): sample 32 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 56 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 82.0621; bswap2(): 35 15 after build: medoids are 15 35 --> sky = sum_j D_j= 500.91 Last swap: new 13 <-> 15 old; decreasing diss. by 0.747984 end{bswap2}: sky = 377.057 obj= 10.0079 C clara(): sample 33 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 50 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 76.1357; bswap2(): 15 29 after build: medoids are 15 29 --> sky = sum_j D_j= 535.787 Last swap: new 6 <-> 15 old; decreasing diss. by 1 end{bswap2}: sky = 429.005 obj= 10.0152 C clara(): sample 34 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 165 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 76.2002; bswap2(): 16 13 after build: medoids are 13 16 --> sky = sum_j D_j= 616.138 Last swap: new 10 <-> 13 old; decreasing diss. by 0.885394 end{bswap2}: sky = 406.402 obj= 10.0032 C clara(): sample 35 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 123 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 83.2469; bswap2(): 25 37 after build: medoids are 25 37 --> sky = sum_j D_j= 635.195 Last swap: new 15 <-> 25 old; decreasing diss. by 1 end{bswap2}: sky = 432.163 obj= 10.1734 C clara(): sample 36 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 58 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 91.5556; bswap2(): 21 10 after build: medoids are 10 21 --> sky = sum_j D_j= 512.215 Last swap: new 34 <-> 21 old; decreasing diss. by 1 end{bswap2}: sky = 482.571 obj= 10.0032 C clara(): sample 37 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 94 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 77.8577; bswap2(): 29 12 after build: medoids are 12 29 --> sky = sum_j D_j= 620.466 Last swap: new 4 <-> 35 old; decreasing diss. by 0.939187 end{bswap2}: sky = 412.779 obj= 10.5208 C clara(): sample 38 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 117 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 79.4464; bswap2(): 7 31 after build: medoids are 7 31 --> sky = sum_j D_j= 605.048 Last swap: new 9 <-> 7 old; decreasing diss. by 1 end{bswap2}: sky = 397.868 obj= 10.0032 C clara(): sample 39 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 63 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 81.7464; bswap2(): 1 28 after build: medoids are 1 28 --> sky = sum_j D_j= 458.896 Last swap: new 40 <-> 1 old; decreasing diss. by 1 end{bswap2}: sky = 414.271 obj= 10.7806 C clara(): sample 40 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 96 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 81.4514; bswap2(): 43 40 after build: medoids are 40 43 --> sky = sum_j D_j= 509.713 Last swap: new 35 <-> 43 old; decreasing diss. by 1 end{bswap2}: sky = 437.147 obj= 10.4477 C clara(): sample 41 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 125 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 73.4388; bswap2(): 20 12 after build: medoids are 12 20 --> sky = sum_j D_j= 446.501 Last swap: new 31 <-> 44 old; decreasing diss. by 0.203346 end{bswap2}: sky = 359.731 obj= 10.1185 C clara(): sample 42 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 23 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 96.0745; bswap2(): 30 16 after build: medoids are 16 30 --> sky = sum_j D_j= 477.285 Last swap: new 37 <-> 30 old; decreasing diss. by 1 end{bswap2}: sky = 428.793 obj= 10.0287 C clara(): sample 43 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 112 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 80.9596; bswap2(): 34 8 after build: medoids are 8 34 --> sky = sum_j D_j= 453.656 Last swap: new 26 <-> 8 old; decreasing diss. by 0.780873 end{bswap2}: sky = 438.756 obj= 10.0292 C clara(): sample 44 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 100 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 91.5542; bswap2(): 8 29 after build: medoids are 8 29 --> sky = sum_j D_j= 572.709 Last swap: new 26 <-> 8 old; decreasing diss. by 1 end{bswap2}: sky = 419.057 obj= 10.6533 C clara(): sample 45 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 186 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 82.7184; bswap2(): 20 9 after build: medoids are 9 20 --> sky = sum_j D_j= 423.178 Last swap: new 12 <-> 9 old; decreasing diss. by 0.132875 end{bswap2}: sky = 370.823 obj= 10.0595 C clara(): sample 46 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 72 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 78.0171; bswap2(): 24 13 after build: medoids are 13 24 --> sky = sum_j D_j= 425.546 Last swap: new 8 <-> 13 old; decreasing diss. by 0.582792 end{bswap2}: sky = 374.277 obj= 10.256 C clara(): sample 47 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 141 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 78.0975; bswap2(): 1 7 after build: medoids are 1 7 --> sky = sum_j D_j= 446.971 Last swap: new 33 <-> 1 old; decreasing diss. by 1 end{bswap2}: sky = 389.032 obj= 10.0032 C clara(): sample 48 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 67 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 88.4769; bswap2(): 26 3 after build: medoids are 3 26 --> sky = sum_j D_j= 504.047 Last swap: new 33 <-> 26 old; decreasing diss. by 1 end{bswap2}: sky = 413.772 obj= 10.6891 C clara(): sample 49 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 121 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 75.9709; bswap2(): 23 20 after build: medoids are 20 23 --> sky = sum_j D_j= 486.38 Last swap: new 18 <-> 23 old; decreasing diss. by 1 end{bswap2}: sky = 354.591 obj= 10.9521 C clara(): sample 50 if (kall && nunfs...): .. kall: T, nsel[ntt=2] = 78 {295} [ntt=44, nunfs=0] -> dysta2() . clara(): s:= max dys[1..946] = 86.3129; bswap2(): 42 14 after build: medoids are 14 42 --> sky = sum_j D_j= 571.882 Last swap: new 34 <-> 42 old; decreasing diss. by 1 end{bswap2}: sky = 453.192 obj= 10.4592 C clara(): best sample _found_ ; nbest[1:44] = c(53,55,74,171,210,251,290,300,323,333,368,373,387,446,459,493,495,663,683,687,705,711,750,775,813,924,929,938,961,999,1004,1008,1019,1026,1056,1111,1139,1192,1227,1372,1399,1400,1416,1444) --> dysta2(nbest), resul(), end $objective [1] 10.00323 $i.med [1] 1139 300 $medoids [,1] [,2] [1,] 49.6543096 10.8671126 [2,] 0.7558529 0.5295663 $clusinfo size max_diss av_diss isolation [1,] 800 28.41036 9.89087 0.5684433 [2,] 700 30.73934 10.13163 0.6150423 > ## ^^^^^^^^^ a bit less output ... > ## for sample 45 > ## From that output I gather the sample indices nsel[] and all k{ran} are > ii <- c(194, 1411, + 1430,398,570,72,27,62,1301,368,1390,991,296,431,1019,186,558,258,413, + 647,585,1352,1073,873,377,711,1498,865,1436,1335,189,622,760,226,146, + 145,1349,382,1368,934,204,303,856,1489) > ## Trying > pp <- pam(x[ii,], k =2) # gives no problem > > for(i in 1:19) + print(clara(x[sample(nrow(x)),], 2, samples = 50)[clInd]) $objective [1] 9.998856 $i.med [1] 977 1459 $medoids [,1] [,2] [1,] 51.0033452 9.12841 [2,] 0.7469202 1.24932 $clusinfo size max_diss av_diss isolation [1,] 800 26.86019 9.87836 0.5280131 [2,] 700 30.34337 10.13657 0.5964848 $objective [1] 10.01977 $i.med [1] 739 1385 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 50.8770815 8.5643877 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6055681 [2,] 800 26.74444 9.921884 0.5268682 $objective [1] 10.00144 $i.med [1] 862 1010 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 49.4297134 9.5070656 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6210615 [2,] 800 27.03542 9.887517 0.5462269 $objective [1] 10.01561 $i.med [1] 603 820 $medoids [,1] [,2] [1,] 49.6543096 10.867113 [2,] 0.7824195 1.649143 $clusinfo size max_diss av_diss isolation [1,] 800 28.41036 9.89087 0.5712506 [2,] 700 30.16311 10.15816 0.6064933 $objective [1] 10.01514 $i.med [1] 44 1430 $medoids [,1] [,2] [1,] 49.6543096 10.8671126 [2,] 0.6604674 -0.1066458 $clusinfo size max_diss av_diss isolation [1,] 800 28.41036 9.89087 0.5658558 [2,] 700 31.01367 10.15717 0.6177065 $objective [1] 10.00107 $i.med [1] 904 1214 $medoids [,1] [,2] [1,] 50.2492576 10.299201 [2,] -0.8155063 1.417238 $clusinfo size max_diss av_diss isolation [1,] 800 27.91319 9.844468 0.5385377 [2,] 700 28.93873 10.180037 0.5583237 $objective [1] 10.00573 $i.med [1] 379 647 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 49.6232996 9.1032208 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6195718 [2,] 800 26.78803 9.895565 0.5399304 $objective [1] 10.03059 $i.med [1] 805 887 $medoids [,1] [,2] [1,] -0.07369905 2.028452 [2,] 49.38189025 9.446208 $clusinfo size max_diss av_diss isolation [1,] 700 29.23504 10.186699 0.5845981 [2,] 800 27.07402 9.893989 0.5413853 $objective [1] 10.0203 $i.med [1] 407 333 $medoids [,1] [,2] [1,] 0.7824195 1.649143 [2,] 51.1016598 11.021770 $clusinfo size max_diss av_diss isolation [1,] 700 30.16311 10.158161 0.5892994 [2,] 800 28.74613 9.899672 0.5616159 $objective [1] 10.01382 $i.med [1] 642 1153 $medoids [,1] [,2] [1,] 0.7824195 1.649143 [2,] 49.4297134 9.507066 $clusinfo size max_diss av_diss isolation [1,] 700 30.16311 10.158161 0.6121028 [2,] 800 27.03542 9.887517 0.5486324 $objective [1] 9.990858 $i.med [1] 270 384 $medoids [,1] [,2] [1,] 50.2492576 10.299201 [2,] 0.7824195 1.649143 $clusinfo size max_diss av_diss isolation [1,] 800 27.91319 9.844468 0.5558465 [2,] 700 30.16311 10.158161 0.6006500 $objective [1] 9.990858 $i.med [1] 1453 272 $medoids [,1] [,2] [1,] 50.2492576 10.299201 [2,] 0.7824195 1.649143 $clusinfo size max_diss av_diss isolation [1,] 800 27.91319 9.844468 0.5558465 [2,] 700 30.16311 10.158161 0.6006500 $objective [1] 9.996497 $i.med [1] 263 368 $medoids [,1] [,2] [1,] 0.9255294 1.737013 [2,] 50.2492576 10.299201 $clusinfo size max_diss av_diss isolation [1,] 700 30.23980 10.170244 0.6040545 [2,] 800 27.91319 9.844468 0.5575794 $objective [1] 10.00415 $i.med [1] 1139 1405 $medoids [,1] [,2] [1,] 50.249258 10.2992014 [2,] 1.581224 0.4703763 $clusinfo size max_diss av_diss isolation [1,] 800 27.91319 9.844468 0.5621923 [2,] 700 31.46479 10.186640 0.6337242 $objective [1] 10.02048 $i.med [1] 560 1486 $medoids [,1] [,2] [1,] 0.7469202 1.249320 [2,] 49.2342914 9.236618 $clusinfo size max_diss av_diss isolation [1,] 700 30.34337 10.136565 0.6174776 [2,] 800 27.19128 9.918899 0.5533336 $objective [1] 9.978477 $i.med [1] 756 367 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 50.2492576 10.2992014 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6093223 [2,] 800 27.91319 9.844468 0.5533016 $objective [1] 10.00415 $i.med [1] 1148 156 $medoids [,1] [,2] [1,] 50.249258 10.2992014 [2,] 1.581224 0.4703763 $clusinfo size max_diss av_diss isolation [1,] 800 27.91319 9.844468 0.5621923 [2,] 700 31.46479 10.186640 0.6337242 $objective [1] 10.03766 $i.med [1] 1204 272 $medoids [,1] [,2] [1,] -0.07369905 2.028452 [2,] 49.98807148 8.743293 $clusinfo size max_diss av_diss isolation [1,] 700 29.23504 10.186699 0.5787959 [2,] 800 26.38109 9.907246 0.5222934 $objective [1] 9.978477 $i.med [1] 778 485 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 50.2492576 10.2992014 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6093223 [2,] 800 27.91319 9.844468 0.5533016 > > clara(x, 2, samples = 101)[clInd] $objective [1] 10.00144 $i.med [1] 551 1232 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 49.4297134 9.5070656 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6210615 [2,] 800 27.03542 9.887517 0.5462269 > clara(x, 2, samples = 149)[clInd] $objective [1] 9.978477 $i.med [1] 551 1079 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 50.2492576 10.2992014 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6093223 [2,] 800 27.91319 9.844468 0.5533016 > clara(x, 2, samples = 200)[clInd] $objective [1] 9.978477 $i.med [1] 551 1079 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 50.2492576 10.2992014 $clusinfo size max_diss av_diss isolation [1,] 700 30.73934 10.131630 0.6093223 [2,] 800 27.91319 9.844468 0.5533016 > ## Note that this last one is practically identical to the slower pam() one > > x[print(sample(length(x), 20))] <- NA [1] 1079 826 357 1917 75 1463 2539 1988 767 1715 772 1407 2391 1574 466 [16] 646 2771 523 861 1725 > clara(x, 2, samples = 50)[clInd] $objective [1] 7.261091 $i.med [1] 551 1039 $medoids [,1] [,2] [1,] 0.7558529 0.5295663 [2,] 46.8740873 NA $clusinfo size max_diss av_diss isolation [1,] 711 30.73934 9.978089 0.4713103 [2,] 789 25.03604 4.858118 0.3838646 Warning message: In clara(x, 2, samples = 50) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > > ###-- Larger example: 2000 objects, divided into 5 clusters. > x5 <- rbind(cbind(rnorm(400, 0,4), rnorm(400, 0,4)), + cbind(rnorm(400,10,8), rnorm(400,40,6)), + cbind(rnorm(400,30,4), rnorm(400, 0,4)), + cbind(rnorm(400,40,4), rnorm(400,20,2)), + cbind(rnorm(400,50,4), rnorm(400,50,4))) > ## plus 1 random dimension > x5 <- cbind(x5, rnorm(nrow(x5))) > > clara(x5, 5) Call: clara(x = x5, k = 5) Medoids: [,1] [,2] [,3] [1,] -1.441508 -0.2898531 0.7516499 [2,] 11.485958 41.8857869 0.7429690 [3,] 41.320516 20.2857507 0.3629901 [4,] 50.642369 48.5485423 0.9250403 [5,] 32.404065 1.1300862 0.7976362 Objective function: 5.97835 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 394 404 402 400 Best sample: [1] 20 31 66 130 189 255 256 262 298 370 418 437 577 611 628 [16] 647 669 789 868 950 952 963 1073 1115 1198 1211 1225 1235 1297 1331 [31] 1342 1357 1358 1371 1398 1441 1509 1534 1601 1609 1721 1729 1743 1774 1815 [46] 1832 1843 1865 1902 1903 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > summary(clara(x5, 5, samples = 50)) Object of class 'clara' from call: clara(x = x5, k = 5, samples = 50) Medoids: [,1] [,2] [,3] [1,] 0.009898956 -1.3995599 0.75311855 [2,] 8.589591773 38.1123175 0.50615564 [3,] 41.128364368 20.9384581 -0.61203968 [4,] 50.399157327 49.7273723 -0.02458452 [5,] 30.555250565 -0.6932155 -0.42527702 Objective function: 5.794641 Numerical information per cluster: size max_diss av_diss isolation [1,] 400 14.80168 5.295404 0.4840910 [2,] 391 26.65813 9.153210 0.7242123 [3,] 404 18.41105 4.009631 0.7646387 [4,] 405 21.78758 5.541303 0.7202381 [5,] 400 14.74078 5.070244 0.6122070 Average silhouette width per cluster: [1] 0.7982753 0.6584968 0.7980377 0.8500952 0.6332051 Average silhouette width of best sample: 0.7206308 Best sample: [1] 87 171 255 282 291 453 507 513 550 560 561 576 589 606 617 [16] 664 704 728 744 753 808 827 924 940 954 962 992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4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1925] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1962] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1999] 4 4 Silhouette plot information for best sample: cluster neighbor sil_width 255 1 5 0.8437647 171 1 5 0.8394921 291 1 5 0.7950084 282 1 5 0.7610594 87 1 5 0.7520517 744 2 3 0.7750689 753 2 3 0.7732461 550 2 3 0.7714897 606 2 3 0.7681556 453 2 3 0.7560121 728 2 3 0.7512566 576 2 1 0.7499464 513 2 1 0.7331192 560 2 1 0.7291131 507 2 3 0.7027174 664 2 3 0.6941632 704 2 1 0.6447163 617 2 1 0.4172408 589 2 3 0.3493197 561 2 3 0.2618876 1475 3 5 0.8414336 1517 3 5 0.8384105 1371 3 5 0.8352902 1443 3 5 0.8336913 1247 3 5 0.8261265 1207 3 5 0.8203274 1348 3 5 0.8174613 1474 3 5 0.7746370 1334 3 5 0.7730061 1285 3 5 0.6199933 1770 4 3 0.8842829 1768 4 3 0.8745956 1913 4 3 0.8654229 1795 4 3 0.8486021 1651 4 3 0.8404848 1762 4 3 0.8281131 1656 4 3 0.8091652 924 5 3 0.7497243 1060 5 3 0.7478978 1120 5 3 0.7450913 992 5 3 0.7287832 1051 5 3 0.7150749 827 5 3 0.7041583 808 5 3 0.6892041 1022 5 3 0.6689111 1040 5 3 0.6474570 962 5 1 0.6266191 940 5 1 0.4965060 954 5 3 0.4877846 1005 5 3 0.2244547 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.91254 22.56800 36.06000 34.34600 47.49500 83.63800 Metric : euclidean Number of objects : 50 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > ## 3 "half" samples: > clara(x5, 5, samples = 999) Call: clara(x = x5, k = 5, samples = 999) Medoids: [,1] [,2] [,3] [1,] 0.4753746 -0.1765723 0.38026681 [2,] 10.5292754 39.9278909 0.07664958 [3,] 40.4696100 19.9154135 -0.11342069 [4,] 49.6841771 50.8667494 0.43448856 [5,] 30.1926628 0.2226872 0.20417028 Objective function: 5.677885 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 393 404 403 400 Best sample: [1] 2 45 63 105 173 305 346 354 384 449 482 503 523 528 540 [16] 612 646 649 670 688 731 809 881 916 959 1002 1031 1114 1186 1210 [31] 1223 1233 1275 1276 1290 1365 1395 1400 1447 1454 1593 1598 1695 1704 1727 [46] 1750 1769 1770 1865 1964 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > clara(x5, 5, samples = 1000) Call: clara(x = x5, k = 5, samples = 1000) Medoids: [,1] [,2] [,3] [1,] 0.4753746 -0.1765723 0.38026681 [2,] 10.5292754 39.9278909 0.07664958 [3,] 40.4696100 19.9154135 -0.11342069 [4,] 49.6841771 50.8667494 0.43448856 [5,] 30.1926628 0.2226872 0.20417028 Objective function: 5.677885 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 393 404 403 400 Best sample: [1] 2 45 63 105 173 305 346 354 384 449 482 503 523 528 540 [16] 612 646 649 670 688 731 809 881 916 959 1002 1031 1114 1186 1210 [31] 1223 1233 1275 1276 1290 1365 1395 1400 1447 1454 1593 1598 1695 1704 1727 [46] 1750 1769 1770 1865 1964 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > clara(x5, 5, samples = 1001) Call: clara(x = x5, k = 5, samples = 1001) Medoids: [,1] [,2] [,3] [1,] 0.4753746 -0.1765723 0.38026681 [2,] 10.5292754 39.9278909 0.07664958 [3,] 40.4696100 19.9154135 -0.11342069 [4,] 49.6841771 50.8667494 0.43448856 [5,] 30.1926628 0.2226872 0.20417028 Objective function: 5.677885 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 393 404 403 400 Best sample: [1] 2 45 63 105 173 305 346 354 384 449 482 503 523 528 540 [16] 612 646 649 670 688 731 809 881 916 959 1002 1031 1114 1186 1210 [31] 1223 1233 1275 1276 1290 1365 1395 1400 1447 1454 1593 1598 1695 1704 1727 [46] 1750 1769 1770 1865 1964 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > clara(x5, 5, samples = 2000)#full sample Call: clara(x = x5, k = 5, samples = 2000) Medoids: [,1] [,2] [,3] [1,] 0.4753746 -0.1765723 0.3802668 [2,] 9.9849318 39.8137651 -0.3637146 [3,] 40.4696100 19.9154135 -0.1134207 [4,] 49.5521365 50.9160832 0.3138241 [5,] 30.1926628 0.2226872 0.2041703 Objective function: 5.675923 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 393 404 403 400 Best sample: [1] 4 15 23 135 157 173 188 246 282 318 364 366 377 529 544 [16] 638 649 676 756 771 772 777 812 847 851 855 859 940 948 991 [31] 1042 1114 1149 1201 1316 1400 1442 1477 1480 1487 1603 1669 1670 1712 1745 [46] 1750 1756 1900 1923 1964 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > ###--- Start a version of example(clara) ------- > > ## xclara : artificial data with 3 clusters of 1000 bivariate objects each. > data(xclara) > (clx3 <- clara(xclara, 3)) Call: clara(x = xclara, k = 3) Medoids: V1 V2 [1,] 5.553391 13.306260 [2,] 43.198760 60.360720 [3,] 74.591890 -6.969018 Objective function: 13.225 Clustering vector: int [1:3000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 900 1148 952 Best sample: [1] 20 30 46 91 92 169 179 187 209 223 382 450 555 971 1004 [16] 1025 1058 1277 1281 1302 1319 1361 1362 1513 1591 1623 1628 1729 1752 1791 [31] 1907 1917 1946 2064 2089 2498 2527 2537 2545 2591 2672 2722 2729 2790 2797 [46] 2852 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > ## Plot similar to Figure 5 in Struyf et al (1996) > plot(clx3) > > ## The rngR = TRUE case is currently in the non-strict tests > ## ./clara-ex.R > ## ~~~~~~~~~~~~ > > ###--- End version of example(clara) ------- > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 2.276 0.017 2.31 0 0 > > proc.time() user system elapsed 2.390 0.036 2.499