R Under development (unstable) (2023-11-26 r85638 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 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. > .libPaths() # show full library tree {also as check of R CMD check!} [1] "D:/temp/RtmpW8YzYv/RLIBS_298f82242202b" [2] "D:/RCompile/recent/R/library" > library(cluster) > > ####---------- Tests for FANNY i.e., fanny() -------------------------- > #### > ### -- thanks to ../.Rbuildignore , the output of this is > ### -- only compared to saved values for the maintainer > > ###--- An extension of example(fanny) : ------------------- > set.seed(21) > ## generate 10+15 objects in two clusters, plus 3 objects lying > ## between those clusters. > x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)), + cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)), + cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5))) > > .proctime00 <- proc.time() > > (fannyx <- fanny(x, 2)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 14.17769 tolerance 1e-15 iterations 9 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 89 11 [2,] 95 5 [3,] 92 8 [4,] 94 6 [5,] 89 11 [6,] 93 7 [7,] 92 8 [8,] 93 7 [9,] 95 5 [10,] 96 4 [11,] 5 95 [12,] 7 93 [13,] 4 96 [14,] 7 93 [15,] 5 95 [16,] 6 94 [17,] 10 90 [18,] 5 95 [19,] 4 96 [20,] 8 92 [21,] 8 92 [22,] 4 96 [23,] 6 94 [24,] 6 94 [25,] 12 88 [26,] 40 60 [27,] 22 78 [28,] 29 71 Fuzzyness coefficients: dunn_coeff normalized 0.8436121 0.6872242 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fannyx) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 14.17769 tolerance 1e-15 iterations 9 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 89 11 [2,] 95 5 [3,] 92 8 [4,] 94 6 [5,] 89 11 [6,] 93 7 [7,] 92 8 [8,] 93 7 [9,] 95 5 [10,] 96 4 [11,] 5 95 [12,] 7 93 [13,] 4 96 [14,] 7 93 [15,] 5 95 [16,] 6 94 [17,] 10 90 [18,] 5 95 [19,] 4 96 [20,] 8 92 [21,] 8 92 [22,] 4 96 [23,] 6 94 [24,] 6 94 [25,] 12 88 [26,] 40 60 [27,] 22 78 [28,] 29 71 Fuzzyness coefficients: dunn_coeff normalized 0.8436121 0.6872242 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Silhouette plot information: cluster neighbor sil_width 10 1 2 0.8803873 9 1 2 0.8726948 2 1 2 0.8624826 4 1 2 0.8569474 8 1 2 0.8446916 7 1 2 0.8379922 6 1 2 0.8260655 3 1 2 0.8218139 1 1 2 0.8018154 5 1 2 0.7778144 22 2 1 0.8622465 19 2 1 0.8526094 11 2 1 0.8524562 13 2 1 0.8521850 18 2 1 0.8474339 15 2 1 0.8473217 16 2 1 0.8430436 23 2 1 0.8391805 24 2 1 0.8387914 12 2 1 0.8326846 14 2 1 0.8293329 20 2 1 0.8187388 21 2 1 0.8173937 17 2 1 0.7951874 25 2 1 0.7718178 27 2 1 0.6444521 28 2 1 0.5321902 26 2 1 0.3304049 Average silhouette width per cluster: [1] 0.8382705 0.7781928 Average silhouette width of total data set: [1] 0.7996491 378 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.07909 1.03510 2.98900 3.88190 6.89260 8.44010 Metric : euclidean Number of objects : 28 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > str(fannyx) List of 11 $ membership : num [1:28, 1:2] 0.889 0.953 0.916 0.937 0.891 ... $ coeff : Named num [1:2] 0.844 0.687 ..- attr(*, "names")= chr [1:2] "dunn_coeff" "normalized" $ memb.exp : num 2 $ clustering : int [1:28] 1 1 1 1 1 1 1 1 1 1 ... $ k.crisp : num 2 $ objective : Named num [1:2] 1.42e+01 1.00e-15 ..- attr(*, "names")= chr [1:2] "objective" "tolerance" $ convergence: Named int [1:3] 9 1 500 ..- attr(*, "names")= chr [1:3] "iterations" "converged" "maxit" $ diss : 'dissimilarity' num [1:378] 1.523 0.987 1.602 1.584 1.903 ... ..- attr(*, "Size")= int 28 ..- attr(*, "Metric")= chr "euclidean" $ call : language fanny(x = x, k = 2) $ silinfo :List of 3 ..$ widths : num [1:28, 1:3] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:28] "10" "9" "2" "4" ... .. .. ..$ : chr [1:3] "cluster" "neighbor" "sil_width" ..$ clus.avg.widths: num [1:2] 0.838 0.778 ..$ avg.width : num 0.8 $ data : num [1:28, 1:2] 0.397 0.261 0.873 -0.636 1.099 ... - attr(*, "class")= chr [1:2] "fanny" "partition" > ## Different platforms differ (even gcc 3.0.1 vs 3.2 on same platform)! > ## {70 or 71 iterations} > ## ==> No "fanny-ex.Rout.save" is distributed ! > ## -------------------------------------------- > summary(fanny(x,3))# one extra cluster Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 9.39325 tolerance 1e-15 iterations 43 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [,3] [1,] 80 10 11 [2,] 91 4 5 [3,] 84 8 9 [4,] 88 5 6 [5,] 79 10 12 [6,] 86 7 8 [7,] 86 7 8 [8,] 87 6 7 [9,] 91 4 5 [10,] 93 3 4 [11,] 3 55 43 [12,] 3 72 25 [13,] 3 41 57 [14,] 4 61 35 [15,] 2 75 23 [16,] 3 54 42 [17,] 5 37 58 [18,] 3 38 60 [19,] 2 38 59 [20,] 4 66 30 [21,] 4 41 55 [22,] 2 61 37 [23,] 3 73 24 [24,] 4 58 38 [25,] 7 43 50 [26,] 22 31 47 [27,] 11 32 58 [28,] 15 33 52 Fuzzyness coefficients: dunn_coeff normalized 0.5864035 0.3796053 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 3 2 2 2 3 3 3 2 3 2 2 2 3 3 3 3 Silhouette plot information: cluster neighbor sil_width 10 1 3 0.86761636 9 1 3 0.85927690 2 1 3 0.84637141 4 1 3 0.84263476 8 1 3 0.82827133 7 1 3 0.82191633 6 1 3 0.80515251 3 1 3 0.80077380 1 1 3 0.78174030 5 1 3 0.74877291 23 2 3 0.69381057 15 2 3 0.68790994 12 2 3 0.68113233 20 2 3 0.60243554 24 2 3 0.53703144 22 2 3 0.51528059 14 2 3 0.49467784 11 2 3 0.47962831 16 2 3 0.47844504 27 3 2 0.34881727 28 3 2 0.33616051 26 3 2 0.32389804 17 3 2 -0.02523208 21 3 2 -0.16440140 25 3 2 -0.21039298 18 3 2 -0.21192236 19 3 2 -0.26773065 13 3 2 -0.29006339 Average silhouette width per cluster: [1] 0.82025266 0.57448351 -0.01787412 Average silhouette width of total data set: [1] 0.4718575 378 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.07909 1.03510 2.98900 3.88190 6.89260 8.44010 Metric : euclidean Number of objects : 28 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > > (fanny(x,2, memb.exp = 1.5)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.5 objective 16.08227 tolerance 1e-15 iterations 10 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 99 1 [2,] 100 0 [3,] 99 1 [4,] 100 0 [5,] 98 2 [6,] 99 1 [7,] 99 1 [8,] 99 1 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 1 99 [13,] 0 100 [14,] 1 99 [15,] 0 100 [16,] 0 100 [17,] 1 99 [18,] 0 100 [19,] 0 100 [20,] 1 99 [21,] 1 99 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 2 98 [26,] 26 74 [27,] 6 94 [28,] 12 88 Fuzzyness coefficients: dunn_coeff normalized 0.9635331 0.9270661 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > (fanny(x,2, memb.exp = 1.2)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.2 objective 16.49219 tolerance 1e-15 iterations 7 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 100 0 [2,] 100 0 [3,] 100 0 [4,] 100 0 [5,] 100 0 [6,] 100 0 [7,] 100 0 [8,] 100 0 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 0 100 [13,] 0 100 [14,] 0 100 [15,] 0 100 [16,] 0 100 [17,] 0 100 [18,] 0 100 [19,] 0 100 [20,] 0 100 [21,] 0 100 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 0 100 [26,] 5 95 [27,] 0 100 [28,] 0 100 Fuzzyness coefficients: dunn_coeff normalized 0.9964339 0.9928679 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > (fanny(x,2, memb.exp = 1.1)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.1 objective 16.51151 tolerance 1e-15 iterations 5 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 100 0 [2,] 100 0 [3,] 100 0 [4,] 100 0 [5,] 100 0 [6,] 100 0 [7,] 100 0 [8,] 100 0 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 0 100 [13,] 0 100 [14,] 0 100 [15,] 0 100 [16,] 0 100 [17,] 0 100 [18,] 0 100 [19,] 0 100 [20,] 0 100 [21,] 0 100 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 0 100 [26,] 0 100 [27,] 0 100 [28,] 0 100 Fuzzyness coefficients: dunn_coeff normalized 0.9998489 0.9996979 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > (fanny(x,2, memb.exp = 3)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 3 objective 8.844693 tolerance 1e-15 iterations 11 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 73 27 [2,] 82 18 [3,] 76 24 [4,] 79 21 [5,] 74 26 [6,] 78 22 [7,] 77 23 [8,] 79 21 [9,] 81 19 [10,] 82 18 [11,] 18 82 [12,] 21 79 [13,] 18 82 [14,] 22 78 [15,] 19 81 [16,] 20 80 [17,] 26 74 [18,] 19 81 [19,] 18 82 [20,] 23 77 [21,] 23 77 [22,] 16 84 [23,] 21 79 [24,] 21 79 [25,] 28 72 [26,] 46 54 [27,] 36 64 [28,] 40 60 Fuzzyness coefficients: dunn_coeff normalized 0.6516764 0.3033528 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > ## for subsetting, when compairing: > not.conv <- setdiff(names(fannyx), c("convergence", "call")) > notMconv <- setdiff(names(fannyx), c("membership", "convergence", "call")) > > data(ruspini) # < to run under R 1.9.1 > summary(fanny(ruspini, 3), digits = 9) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 719.5606 tolerance 1e-15 iterations 21 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] 1 68 13 19 2 73 12 15 3 76 10 14 4 73 14 13 5 69 11 20 6 80 9 11 7 64 20 16 8 79 10 11 9 83 7 10 10 85 7 9 11 82 9 10 12 82 8 10 13 78 11 12 14 81 7 12 15 77 8 15 16 81 7 12 17 70 10 20 18 79 8 13 19 78 8 14 20 73 12 15 21 17 74 10 22 14 78 8 23 12 80 8 24 14 78 8 25 10 83 6 26 9 86 5 27 10 84 6 28 11 83 6 29 14 77 8 30 14 78 8 31 11 83 7 32 8 87 5 33 8 87 5 34 8 87 5 35 8 88 5 36 9 86 6 37 8 86 5 38 9 86 6 39 9 85 6 40 11 82 7 41 20 68 12 42 13 78 9 43 13 78 9 44 22 61 17 45 27 52 21 46 33 39 28 47 35 38 28 48 35 39 26 49 26 53 22 50 27 50 24 51 25 53 22 52 26 51 23 53 25 54 21 54 27 48 24 55 28 45 27 56 28 44 27 57 27 47 26 58 26 49 24 59 28 46 27 60 28 44 28 61 15 8 77 62 12 6 82 63 13 8 79 64 11 5 83 65 8 4 88 66 11 6 83 67 7 4 89 68 14 7 79 69 8 4 89 70 7 3 90 71 7 3 89 72 11 5 83 73 11 6 83 74 12 6 81 75 13 6 81 Fuzzyness coefficients: dunn_coeff normalized 0.6045235 0.4067852 Closest hard clustering: 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 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 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 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Silhouette plot information: cluster neighbor sil_width 10 1 3 0.8056096 6 1 3 0.7954977 9 1 3 0.7923048 11 1 3 0.7831672 8 1 3 0.7823246 12 1 3 0.7658171 3 1 3 0.7587961 14 1 3 0.7569107 4 1 3 0.7532051 2 1 3 0.7456150 16 1 3 0.7436018 13 1 3 0.7398841 18 1 3 0.7080079 15 1 3 0.7006854 19 1 3 0.7000938 1 1 3 0.6798381 5 1 3 0.6646571 20 1 3 0.6619626 7 1 2 0.6437853 17 1 3 0.6148541 39 2 1 0.6283295 38 2 1 0.6262721 40 2 1 0.6255492 43 2 1 0.6243319 36 2 1 0.6221530 35 2 1 0.6178548 37 2 1 0.6121605 42 2 1 0.6088119 44 2 1 0.6066538 32 2 1 0.6052260 34 2 1 0.5958391 31 2 1 0.5954537 33 2 1 0.5899279 26 2 1 0.5890979 53 2 1 0.5846364 51 2 1 0.5785105 49 2 1 0.5734352 25 2 1 0.5691955 52 2 1 0.5584872 27 2 1 0.5574419 28 2 1 0.5478805 23 2 1 0.5457126 58 2 1 0.5443257 50 2 1 0.5431889 54 2 1 0.5338363 24 2 1 0.5282567 45 2 1 0.5249071 57 2 1 0.5237845 22 2 1 0.5150893 59 2 3 0.5015850 30 2 1 0.4973340 55 2 1 0.4949786 29 2 1 0.4899519 56 2 3 0.4856790 41 2 1 0.4816846 60 2 3 0.4766350 21 2 1 0.4658079 46 2 1 0.3138537 47 2 1 0.2329901 48 2 1 0.2275249 70 3 1 0.8548947 67 3 1 0.8527439 65 3 1 0.8503105 69 3 1 0.8391810 71 3 1 0.8381065 66 3 1 0.8229841 62 3 1 0.8153092 64 3 1 0.8061254 73 3 1 0.7950213 63 3 1 0.7795369 72 3 1 0.7748121 61 3 1 0.7701103 68 3 1 0.7620559 74 3 1 0.7596815 75 3 1 0.7425538 Average silhouette width per cluster: [1] 0.7298309 0.5361094 0.8042285 Average silhouette width of total data set: [1] 0.6413923 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fanny(ruspini, 4), digits = 9)# 'correct' #{clusters} Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 422.8389 tolerance 1e-15 iterations 12 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] [,4] 1 66 10 9 15 2 71 9 8 11 3 76 7 6 10 4 69 11 9 11 5 68 9 8 15 6 80 7 6 8 7 57 18 13 13 8 76 9 7 9 9 85 5 4 7 10 86 4 4 6 11 78 7 6 8 12 78 7 7 9 13 72 10 9 10 14 82 5 5 8 15 76 6 6 11 16 81 5 5 9 17 68 8 8 16 18 77 6 6 11 19 75 7 7 11 20 65 11 11 14 21 10 74 10 6 22 7 80 8 4 23 6 82 8 4 24 8 79 9 5 25 5 87 6 3 26 4 89 5 2 27 4 87 5 3 28 5 85 6 3 29 8 78 9 5 30 8 79 9 5 31 6 81 9 4 32 3 89 5 2 33 4 87 6 3 34 5 84 7 3 35 4 87 6 3 36 5 83 8 4 37 6 79 10 4 38 7 76 12 5 39 7 78 11 4 40 8 71 15 6 41 16 49 25 10 42 12 57 23 8 43 12 55 25 8 44 10 23 59 8 45 10 16 65 8 46 17 18 51 15 47 20 20 44 17 48 21 21 42 16 49 4 7 85 4 50 4 6 87 4 51 5 8 83 4 52 3 5 88 3 53 6 11 78 5 54 4 5 88 3 55 6 7 82 5 56 6 8 80 6 57 4 6 85 4 58 7 11 76 6 59 7 10 77 7 60 8 11 74 8 61 12 6 8 74 62 9 5 6 79 63 11 6 9 74 64 8 4 5 83 65 6 3 3 88 66 9 4 6 81 67 5 2 3 91 68 12 5 6 77 69 5 2 3 89 70 4 2 3 91 71 5 2 3 89 72 10 4 5 81 73 10 5 7 79 74 11 5 7 76 75 12 5 6 77 Fuzzyness coefficients: dunn_coeff normalized 0.6237448 0.4983264 Closest hard clustering: 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 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 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 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Silhouette plot information: cluster neighbor sil_width 10 1 4 0.8056096 6 1 4 0.7954977 9 1 4 0.7923048 11 1 4 0.7831672 8 1 2 0.7811793 12 1 4 0.7658171 3 1 4 0.7587961 14 1 4 0.7569107 2 1 4 0.7456150 16 1 4 0.7436018 13 1 4 0.7398841 4 1 2 0.7361533 18 1 4 0.7080079 15 1 4 0.7006854 19 1 4 0.7000938 1 1 4 0.6798381 5 1 4 0.6646571 20 1 4 0.6619626 17 1 4 0.6148541 7 1 2 0.5900575 26 2 3 0.8357433 32 2 3 0.8332753 27 2 3 0.8290271 25 2 3 0.8285547 28 2 3 0.8192636 35 2 3 0.8186309 33 2 3 0.8175087 23 2 3 0.8089969 22 2 3 0.8025389 34 2 3 0.8013310 31 2 3 0.7949677 36 2 3 0.7943536 24 2 3 0.7930770 29 2 3 0.7897346 30 2 3 0.7892027 21 2 3 0.7698024 37 2 3 0.7684502 39 2 3 0.7631648 38 2 3 0.7438848 40 2 3 0.7083130 42 2 3 0.5291270 43 2 3 0.4931623 41 2 3 0.4290814 54 3 2 0.7741745 57 3 2 0.7703455 55 3 2 0.7641810 50 3 2 0.7619943 52 3 2 0.7616220 56 3 2 0.7575313 59 3 2 0.7327828 49 3 2 0.7317002 51 3 2 0.7209864 60 3 2 0.7206840 58 3 2 0.7019611 53 3 2 0.6775322 45 3 2 0.5974787 46 3 2 0.5740823 47 3 2 0.4835635 48 3 2 0.4247331 44 3 2 0.4196093 70 4 1 0.8548947 67 4 1 0.8527439 65 4 1 0.8503105 69 4 1 0.8391810 71 4 1 0.8381065 66 4 1 0.8229841 62 4 1 0.8153092 64 4 1 0.8061254 73 4 1 0.7950213 63 4 1 0.7795369 72 4 1 0.7748121 61 4 1 0.7701103 68 4 1 0.7620559 74 4 1 0.7596815 75 4 1 0.7425538 Average silhouette width per cluster: [1] 0.7262347 0.7548344 0.6691154 0.8042285 Average silhouette width of total data set: [1] 0.737657 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fanny(ruspini, 5), digits = 9) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 344.054 tolerance 1e-15 iterations 30 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] [,4] [,5] 1 60 10 10 8 13 2 65 9 9 7 10 3 71 7 7 6 9 4 60 11 11 8 10 5 63 8 8 7 14 6 74 7 7 5 7 7 47 16 16 10 11 8 68 8 9 6 8 9 81 4 4 4 6 10 83 4 4 4 5 11 72 7 7 6 8 12 72 7 7 6 8 13 64 9 10 8 9 14 79 5 5 4 7 15 73 6 6 5 10 16 78 5 5 5 8 17 64 7 8 7 14 18 73 6 6 6 10 19 71 6 7 6 10 20 58 10 11 9 12 21 5 60 26 6 3 22 4 67 23 4 2 23 4 65 25 4 2 24 4 62 26 5 3 25 3 68 25 3 2 26 3 61 31 3 2 27 3 69 24 3 2 28 3 64 27 4 2 29 4 63 25 5 3 30 4 61 27 5 3 31 4 47 41 6 3 32 3 48 44 4 2 33 3 43 48 4 2 34 3 35 56 4 2 35 3 36 56 4 2 36 3 34 56 5 2 37 3 26 64 5 2 38 3 24 65 5 2 39 4 30 58 6 2 40 5 31 53 8 3 41 10 28 41 15 6 42 6 26 51 12 4 43 6 25 50 13 4 44 8 17 24 44 7 45 9 14 18 52 7 46 14 15 18 41 12 47 16 16 20 34 14 48 17 17 21 32 13 49 4 6 8 78 4 50 4 5 7 82 3 51 4 7 9 76 4 52 3 5 6 84 3 53 6 9 12 69 5 54 3 4 6 84 3 55 5 6 7 77 5 56 5 7 8 75 5 57 4 5 6 82 3 58 6 9 11 69 5 59 6 8 10 71 6 60 7 9 11 67 7 61 12 6 6 7 69 62 9 5 5 6 75 63 11 6 6 8 69 64 8 4 4 4 80 65 5 3 3 3 86 66 8 4 5 6 77 67 4 2 2 2 89 68 11 5 5 6 73 69 5 2 2 3 88 70 4 2 2 3 89 71 5 2 2 3 87 72 9 4 4 5 78 73 9 5 5 6 75 74 11 5 6 7 71 75 11 5 5 6 73 Fuzzyness coefficients: dunn_coeff normalized 0.5114030 0.3892538 Closest hard clustering: 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 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 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 52 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 Silhouette plot information: cluster neighbor sil_width 10 1 5 0.80560959 6 1 5 0.79549768 9 1 5 0.79230476 11 1 5 0.78316718 8 1 2 0.77898970 12 1 5 0.76581709 3 1 5 0.75879612 14 1 5 0.75691067 2 1 5 0.74561500 16 1 5 0.74360183 13 1 5 0.73988410 4 1 2 0.73129406 18 1 5 0.70800786 15 1 5 0.70068540 19 1 5 0.70009384 1 1 5 0.67983808 5 1 5 0.66465711 20 1 5 0.66196261 17 1 5 0.61485412 7 1 2 0.57933844 22 2 3 0.64692795 23 2 3 0.61550541 24 2 3 0.60008003 25 2 3 0.58870755 21 2 3 0.58680476 29 2 3 0.57562680 27 2 3 0.53630654 30 2 3 0.50899690 28 2 3 0.47603437 26 2 3 0.45468170 31 2 3 0.22164438 32 2 3 0.17652220 43 3 2 0.45636660 42 3 2 0.45534454 38 3 2 0.45388647 37 3 2 0.37929513 39 3 2 0.28792444 40 3 2 0.27156486 41 3 2 0.26700037 34 3 2 0.13274819 36 3 2 0.13049634 35 3 2 0.03864907 33 3 2 -0.10466026 54 4 3 0.74140256 57 4 3 0.73972663 55 4 3 0.73410322 56 4 3 0.72732850 50 4 3 0.72559236 52 4 3 0.72450938 59 4 3 0.70004311 60 4 3 0.68771996 49 4 3 0.68729634 51 4 3 0.67478586 58 4 3 0.66155189 53 4 3 0.62364614 45 4 3 0.52499298 46 4 3 0.52187006 47 4 3 0.42305501 48 4 3 0.35520120 44 4 3 0.28882028 70 5 1 0.85489470 67 5 1 0.85274392 65 5 1 0.85031051 69 5 1 0.83918099 71 5 1 0.83810647 66 5 1 0.82298407 62 5 1 0.81530920 64 5 1 0.80612543 73 5 1 0.79502130 63 5 1 0.77953687 72 5 1 0.77481212 61 5 1 0.77011029 68 5 1 0.76205594 74 5 1 0.75968147 75 5 1 0.74255385 Average silhouette width per cluster: [1] 0.7253463 0.4989865 0.2516923 0.6200968 0.8042285 Average silhouette width of total data set: [1] 0.6115794 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 0.05 0.01 0.06 NA NA > data(chorSub) > p4cl <- pam(chorSub, k = 4, cluster.only = TRUE) > ## The first two are "completely fuzzy" -- and now give a warnings > f4.20 <- fanny(chorSub, k = 4, trace.lev = 1) ; f4.20$coef fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 8277.57 Converged after 46 iterations, obj = 2665.982 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 2 < k (= 4) !! Warning message: In fanny(chorSub, k = 4, trace.lev = 1) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? dunn_coeff normalized 2.500000e-01 1.850372e-15 > f4.18 <- fanny(chorSub, k = 4, memb.exp = 1.8) # same problem Warning message: In fanny(chorSub, k = 4, memb.exp = 1.8) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > f4.18. <- fanny(chorSub, k = 4, memb.exp = 1.8, + iniMem.p = f4.20$membership) # very quick convergence Warning message: In fanny(chorSub, k = 4, memb.exp = 1.8, iniMem.p = f4.20$membership) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > stopifnot(all.equal(f4.18[not.conv], f4.18.[not.conv], tol = 5e-7)) > > f4.16 <- fanny(chorSub, k = 4, memb.exp = 1.6) # now gives 4 crisp clusters > ## IGNORE_RDIFF_BEGIN > f4.16. <- fanny(chorSub, k = 4, memb.exp = 1.6, + iniMem.p = f4.18$membership, trace.lev = 2)# wrongly "converged" immediately; no longer! fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 4641.75 ef[]= ( 15405.8, 15405.8, 15405.8, 15405.8) esp[]= ( 6.63795, 6.63795, 6.63795, 6.63795) m == n: obj = 4641.7451124068 Converged after 1 iterations, obj = 4641.7451124068174977 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 2 < k (= 4) !! Warning message: In fanny(chorSub, k = 4, memb.exp = 1.6, iniMem.p = f4.18$membership, : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > f4.16.2<- fanny(chorSub, k = 4, memb.exp = 1.6, + iniMem.p = cluster:::as.membership(p4cl), tol = 1e-10, trace.lev = 2) fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 7365.64 ef[]= ( 46750.7, 97854, 64737.8, 24170.1) esp[]= ( 17, 17, 17, 10) m == n: obj = 4744.9792255200 not converged: it = 1 m == n: obj = 4679.5979841397 not converged: it = 2 m == n: obj = 4661.1063474652 not converged: it = 3 m == n: obj = 4651.1976132009 not converged: it = 4 m == n: obj = 4645.1558185569 not converged: it = 5 m == n: obj = 4641.3016999595 not converged: it = 6 m == n: obj = 4638.7561402053 not converged: it = 7 m == n: obj = 4637.0268537669 not converged: it = 8 m == n: obj = 4635.8286004555 not converged: it = 9 m == n: obj = 4634.9880315172 not converged: it = 10 m == n: obj = 4634.3943437634 not converged: it = 11 m == n: obj = 4633.9736501112 not converged: it = 12 m == n: obj = 4633.6751509742 not converged: it = 13 m == n: obj = 4633.4632343974 not converged: it = 14 m == n: obj = 4633.3126714974 not converged: it = 15 m == n: obj = 4633.2055165701 not converged: it = 16 m == n: obj = 4633.1290071452 not converged: it = 17 m == n: obj = 4633.0740913561 not converged: it = 18 m == n: obj = 4633.0343739482 not converged: it = 19 m == n: obj = 4633.0053552141 not converged: it = 20 m == n: obj = 4632.9838809909 not converged: it = 21 m == n: obj = 4632.9677467724 not converged: it = 22 m == n: obj = 4632.9554145804 not converged: it = 23 m == n: obj = 4632.9458119538 not converged: it = 24 m == n: obj = 4632.9381902596 not converged: it = 25 m == n: obj = 4632.9320254723 not converged: it = 26 m == n: obj = 4632.9269490798 not converged: it = 27 m == n: obj = 4632.9227001877 not converged: it = 28 m == n: obj = 4632.9190924339 not converged: it = 29 m == n: obj = 4632.9159911876 not converged: it = 30 m == n: obj = 4632.9132978577 not converged: it = 31 m == n: obj = 4632.9109390974 not converged: it = 32 m == n: obj = 4632.9088593706 not converged: it = 33 m == n: obj = 4632.9070158249 not converged: it = 34 m == n: obj = 4632.9053747439 not converged: it = 35 m == n: obj = 4632.9039090813 not converged: it = 36 m == n: obj = 4632.9025967379 not converged: it = 37 m == n: obj = 4632.9014193477 not converged: it = 38 m == n: obj = 4632.9003614151 not converged: it = 39 m == n: obj = 4632.8994096946 not converged: it = 40 m == n: obj = 4632.8985527385 not converged: it = 41 m == n: obj = 4632.8977805631 not converged: it = 42 m == n: obj = 4632.8970843966 not converged: it = 43 m == n: obj = 4632.8964564866 not converged: it = 44 m == n: obj = 4632.8958899491 not converged: it = 45 m == n: obj = 4632.8953786491 not converged: it = 46 m == n: obj = 4632.8949171027 not converged: it = 47 m == n: obj = 4632.8945003975 not converged: it = 48 m == n: obj = 4632.8941241249 not converged: it = 49 m == n: obj = 4632.8937843232 not converged: it = 50 m == n: obj = 4632.8934774285 not converged: it = 51 m == n: obj = 4632.8932002321 not converged: it = 52 m == n: obj = 4632.8929498430 not converged: it = 53 m == n: obj = 4632.8927236556 not converged: it = 54 m == n: obj = 4632.8925193198 not converged: it = 55 m == n: obj = 4632.8923347162 not converged: it = 56 m == n: obj = 4632.8921679323 not converged: it = 57 m == n: obj = 4632.8920172421 not converged: it = 58 m == n: obj = 4632.8918810877 not converged: it = 59 m == n: obj = 4632.8917580629 not converged: it = 60 m == n: obj = 4632.8916468978 not converged: it = 61 m == n: obj = 4632.8915464462 not converged: it = 62 m == n: obj = 4632.8914556728 not converged: it = 63 m == n: obj = 4632.8913736426 not converged: it = 64 m == n: obj = 4632.8912995115 not converged: it = 65 m == n: obj = 4632.8912325169 not converged: it = 66 m == n: obj = 4632.8911719701 not converged: it = 67 m == n: obj = 4632.8911172490 not converged: it = 68 m == n: obj = 4632.8910677916 not converged: it = 69 m == n: obj = 4632.8910230905 not converged: it = 70 m == n: obj = 4632.8909826870 not converged: it = 71 m == n: obj = 4632.8909461670 not converged: it = 72 m == n: obj = 4632.8909131563 not converged: it = 73 m == n: obj = 4632.8908833169 not converged: it = 74 m == n: obj = 4632.8908563432 not converged: it = 75 m == n: obj = 4632.8908319595 not converged: it = 76 m == n: obj = 4632.8908099163 not converged: it = 77 m == n: obj = 4632.8907899884 not converged: it = 78 m == n: obj = 4632.8907719724 not converged: it = 79 m == n: obj = 4632.8907556842 not converged: it = 80 m == n: obj = 4632.8907409578 not converged: it = 81 m == n: obj = 4632.8907276430 not converged: it = 82 m == n: obj = 4632.8907156041 not converged: it = 83 m == n: obj = 4632.8907047185 not converged: it = 84 m == n: obj = 4632.8906948754 not converged: it = 85 m == n: obj = 4632.8906859747 not converged: it = 86 m == n: obj = 4632.8906779259 not converged: it = 87 m == n: obj = 4632.8906706472 not converged: it = 88 m == n: obj = 4632.8906640647 not converged: it = 89 m == n: obj = 4632.8906581117 not converged: it = 90 m == n: obj = 4632.8906527276 not converged: it = 91 m == n: obj = 4632.8906478581 not converged: it = 92 m == n: obj = 4632.8906434537 not converged: it = 93 m == n: obj = 4632.8906394699 not converged: it = 94 m == n: obj = 4632.8906358664 not converged: it = 95 m == n: obj = 4632.8906326068 not converged: it = 96 m == n: obj = 4632.8906296582 not converged: it = 97 m == n: obj = 4632.8906269907 not converged: it = 98 m == n: obj = 4632.8906245774 not converged: it = 99 m == n: obj = 4632.8906223942 not converged: it = 100 m == n: obj = 4632.8906204189 not converged: it = 101 m == n: obj = 4632.8906186316 not converged: it = 102 m == n: obj = 4632.8906170145 not converged: it = 103 m == n: obj = 4632.8906155512 not converged: it = 104 m == n: obj = 4632.8906142271 not converged: it = 105 m == n: obj = 4632.8906130289 not converged: it = 106 m == n: obj = 4632.8906119446 not converged: it = 107 m == n: obj = 4632.8906109632 not converged: it = 108 m == n: obj = 4632.8906100750 not converged: it = 109 m == n: obj = 4632.8906092711 not converged: it = 110 m == n: obj = 4632.8906085435 not converged: it = 111 m == n: obj = 4632.8906078849 not converged: it = 112 m == n: obj = 4632.8906072887 not converged: it = 113 m == n: obj = 4632.8906067490 not converged: it = 114 m == n: obj = 4632.8906062603 not converged: it = 115 m == n: obj = 4632.8906058180 Converged after 116 iterations, obj = 4632.8906058179818501 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 4 > all.equal((m1 <- f4.16 $membership), + (m2 <- f4.16.2$membership)) [1] "Mean relative difference: 0.0002281145" > ## IGNORE_RDIFF_END > stopifnot(identical(dimnames(m1), dimnames(m2)), + 0 < m1,m1 < 1, 0 < m2,m2 < 1, + ## the memberships are quite close but have only converged to precision 0.000228 + all.equal(m1, m2, tol = 0.001)) > stopifnot(exprs = { + f4.16$clustering == f4.16.2$clustering + all.equal(f4.16[notMconv], f4.16.2[notMconv], tol = 1e-7) + }) > > f4.14 <- fanny(chorSub, k = 4, memb.exp = 1.4) > f4.12 <- fanny(chorSub, k = 4, memb.exp = 1.2) > > table(f4.12$clustering, f4.14$clustering)# close but different 1 2 3 4 1 14 0 8 0 2 1 14 0 2 3 0 0 12 5 4 0 0 0 5 > table(f4.16$clustering, f4.14$clustering)# ditto 1 2 3 4 1 2 0 1 5 2 1 14 0 7 3 3 0 4 0 4 9 0 15 0 > table(f4.12$clustering, f4.16$clustering)# hence differ even more 1 2 3 4 1 2 0 3 17 2 1 16 0 0 3 5 1 4 7 4 0 5 0 0 > > symnum(cbind(f4.16$membership, 1, f4.12$membership), + cutpoints= c(0., 0.2, 0.6, 0.8, 0.9, 0.95, 1 -1e-7, 1 +1e-7), + symbols = c(" ", ".", ",", "+", "*", "B","1")) 190 . . . . 1 , 191 . . 1 B 192 . . . . 1 + 193 . . 1 * 194 . . 1 B 195 . . . . 1 + 196 . . . . 1 , 197 . . . . 1 + 198 . . 1 + 199 . . 1 B 200 . . . . 1 , . 201 . . 1 B 202 . . 1 B 203 . . . . 1 . . 204 . . 1 + 205 . . . . 1 * 206 . . 1 + 207 . . 1 B 208 . . 1 B 209 . . 1 B 210 . . 1 + 211 . . 1 + 212 . . . . 1 . . 213 . . . . 1 , 214 . . . . 1 . , 215 . . 1 B 216 . . 1 B 217 . . 1 B 218 . . 1 . , 219 . . . . 1 . . 220 . . 1 B 221 . . 1 , 222 . . 1 B 223 . . . . 1 . . 224 . . 1 , . 225 . . . . 1 + 226 . . 1 + 227 . . 1 B 228 . . . . 1 . . 229 . . . . 1 . . . 230 . . 1 , . 231 . . 1 * 232 . . 1 . , 233 . . 1 B 234 . . 1 , . 235 . . . . 1 + 236 . . . . 1 B 237 . . 1 B 238 . . 1 + 239 . . 1 B 240 . . 1 B 241 . . . . 1 , . 242 . . 1 B 243 . . 1 * 244 . . 1 + 245 . . 1 B 246 . . 1 B 247 . . . . 1 B 248 . . 1 + 249 . . 1 + 250 . . 1 + attr(,"legend") [1] 0 ' ' 0.2 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 0.9999999 '1' 1 > > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 0.15 0.03 0.19 NA NA > > proc.time() user system elapsed 0.35 0.06 0.36