This vignette is designed to be used with the ‘ppclust
’
package. You can download the recent version of the package from CRAN
with the following command:
If you have already installed ‘ppclust
’, you can load it
into R working environment by using the following command:
For visualization of the clustering results, some examples in this
vignette use the functions from some cluster analysis packages such as
‘cluster
’, ‘fclust
’ and
‘factoextra
’. Therefore, these packages should be loaded
into R working environment with the following commands:
We demonstrate UPFC on the Iris data set (Anderson, 1935). It is a real data set of the four features (Sepal.Length, Sepal.Width, Petal.Length and Petal.Width) of three species (in the last column as the class variable). This four-dimensional data set contains totally 150 observations as 50 samples from each of three iris species. One of these three natural clusters (Class 1) is linearly well-separated from the other two clusters, while Classes 2 and 3 have some overlap as seen in the plot below.
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## 1 5.1 3.5 1.4 0.2
## 2 4.9 3.0 1.4 0.2
## 3 4.7 3.2 1.3 0.2
## 4 4.6 3.1 1.5 0.2
## 5 5.0 3.6 1.4 0.2
## 6 5.4 3.9 1.7 0.4
## 7 4.6 3.4 1.4 0.3
## 8 5.0 3.4 1.5 0.2
## 9 4.4 2.9 1.4 0.2
## 10 4.9 3.1 1.5 0.1
## 11 5.4 3.7 1.5 0.2
## 12 4.8 3.4 1.6 0.2
## 13 4.8 3.0 1.4 0.1
## 14 4.3 3.0 1.1 0.1
## 15 5.8 4.0 1.2 0.2
## 16 5.7 4.4 1.5 0.4
## 17 5.4 3.9 1.3 0.4
## 18 5.1 3.5 1.4 0.3
## 19 5.7 3.8 1.7 0.3
## 20 5.1 3.8 1.5 0.3
## 21 5.4 3.4 1.7 0.2
## 22 5.1 3.7 1.5 0.4
## 23 4.6 3.6 1.0 0.2
## 24 5.1 3.3 1.7 0.5
## 25 4.8 3.4 1.9 0.2
## 26 5.0 3.0 1.6 0.2
## 27 5.0 3.4 1.6 0.4
## 28 5.2 3.5 1.5 0.2
## 29 5.2 3.4 1.4 0.2
## 30 4.7 3.2 1.6 0.2
## 31 4.8 3.1 1.6 0.2
## 32 5.4 3.4 1.5 0.4
## 33 5.2 4.1 1.5 0.1
## 34 5.5 4.2 1.4 0.2
## 35 4.9 3.1 1.5 0.2
## 36 5.0 3.2 1.2 0.2
## 37 5.5 3.5 1.3 0.2
## 38 4.9 3.6 1.4 0.1
## 39 4.4 3.0 1.3 0.2
## 40 5.1 3.4 1.5 0.2
## 41 5.0 3.5 1.3 0.3
## 42 4.5 2.3 1.3 0.3
## 43 4.4 3.2 1.3 0.2
## 44 5.0 3.5 1.6 0.6
## 45 5.1 3.8 1.9 0.4
## 46 4.8 3.0 1.4 0.3
## 47 5.1 3.8 1.6 0.2
## 48 4.6 3.2 1.4 0.2
## 49 5.3 3.7 1.5 0.2
## 50 5.0 3.3 1.4 0.2
## 51 7.0 3.2 4.7 1.4
## 52 6.4 3.2 4.5 1.5
## 53 6.9 3.1 4.9 1.5
## 54 5.5 2.3 4.0 1.3
## 55 6.5 2.8 4.6 1.5
## 56 5.7 2.8 4.5 1.3
## 57 6.3 3.3 4.7 1.6
## 58 4.9 2.4 3.3 1.0
## 59 6.6 2.9 4.6 1.3
## 60 5.2 2.7 3.9 1.4
## 61 5.0 2.0 3.5 1.0
## 62 5.9 3.0 4.2 1.5
## 63 6.0 2.2 4.0 1.0
## 64 6.1 2.9 4.7 1.4
## 65 5.6 2.9 3.6 1.3
## 66 6.7 3.1 4.4 1.4
## 67 5.6 3.0 4.5 1.5
## 68 5.8 2.7 4.1 1.0
## 69 6.2 2.2 4.5 1.5
## 70 5.6 2.5 3.9 1.1
## 71 5.9 3.2 4.8 1.8
## 72 6.1 2.8 4.0 1.3
## 73 6.3 2.5 4.9 1.5
## 74 6.1 2.8 4.7 1.2
## 75 6.4 2.9 4.3 1.3
## 76 6.6 3.0 4.4 1.4
## 77 6.8 2.8 4.8 1.4
## 78 6.7 3.0 5.0 1.7
## 79 6.0 2.9 4.5 1.5
## 80 5.7 2.6 3.5 1.0
## 81 5.5 2.4 3.8 1.1
## 82 5.5 2.4 3.7 1.0
## 83 5.8 2.7 3.9 1.2
## 84 6.0 2.7 5.1 1.6
## 85 5.4 3.0 4.5 1.5
## 86 6.0 3.4 4.5 1.6
## 87 6.7 3.1 4.7 1.5
## 88 6.3 2.3 4.4 1.3
## 89 5.6 3.0 4.1 1.3
## 90 5.5 2.5 4.0 1.3
## 91 5.5 2.6 4.4 1.2
## 92 6.1 3.0 4.6 1.4
## 93 5.8 2.6 4.0 1.2
## 94 5.0 2.3 3.3 1.0
## 95 5.6 2.7 4.2 1.3
## 96 5.7 3.0 4.2 1.2
## 97 5.7 2.9 4.2 1.3
## 98 6.2 2.9 4.3 1.3
## 99 5.1 2.5 3.0 1.1
## 100 5.7 2.8 4.1 1.3
## 101 6.3 3.3 6.0 2.5
## 102 5.8 2.7 5.1 1.9
## 103 7.1 3.0 5.9 2.1
## 104 6.3 2.9 5.6 1.8
## 105 6.5 3.0 5.8 2.2
## 106 7.6 3.0 6.6 2.1
## 107 4.9 2.5 4.5 1.7
## 108 7.3 2.9 6.3 1.8
## 109 6.7 2.5 5.8 1.8
## 110 7.2 3.6 6.1 2.5
## 111 6.5 3.2 5.1 2.0
## 112 6.4 2.7 5.3 1.9
## 113 6.8 3.0 5.5 2.1
## 114 5.7 2.5 5.0 2.0
## 115 5.8 2.8 5.1 2.4
## 116 6.4 3.2 5.3 2.3
## 117 6.5 3.0 5.5 1.8
## 118 7.7 3.8 6.7 2.2
## 119 7.7 2.6 6.9 2.3
## 120 6.0 2.2 5.0 1.5
## 121 6.9 3.2 5.7 2.3
## 122 5.6 2.8 4.9 2.0
## 123 7.7 2.8 6.7 2.0
## 124 6.3 2.7 4.9 1.8
## 125 6.7 3.3 5.7 2.1
## 126 7.2 3.2 6.0 1.8
## 127 6.2 2.8 4.8 1.8
## 128 6.1 3.0 4.9 1.8
## 129 6.4 2.8 5.6 2.1
## 130 7.2 3.0 5.8 1.6
## 131 7.4 2.8 6.1 1.9
## 132 7.9 3.8 6.4 2.0
## 133 6.4 2.8 5.6 2.2
## 134 6.3 2.8 5.1 1.5
## 135 6.1 2.6 5.6 1.4
## 136 7.7 3.0 6.1 2.3
## 137 6.3 3.4 5.6 2.4
## 138 6.4 3.1 5.5 1.8
## 139 6.0 3.0 4.8 1.8
## 140 6.9 3.1 5.4 2.1
## 141 6.7 3.1 5.6 2.4
## 142 6.9 3.1 5.1 2.3
## 143 5.8 2.7 5.1 1.9
## 144 6.8 3.2 5.9 2.3
## 145 6.7 3.3 5.7 2.5
## 146 6.7 3.0 5.2 2.3
## 147 6.3 2.5 5.0 1.9
## 148 6.5 3.0 5.2 2.0
## 149 6.2 3.4 5.4 2.3
## 150 5.9 3.0 5.1 1.8
Plot the data by the classes of iris species
Unsupervised Possibilistic Fuzzy C-Means (UPFC) is an extension of Possibilistic Clustering Algorithm (PCA) by Yang & Wu (2006). Wu et al (2010) reported that PCA is very sensitive to initializations and sometimes generates coincident clusters. They proposed the algorithm UPFC to overcome this problem with inspiration by Pal et al’s PFCM algorithm (Pal et al, 2005). The algorithm UPFC produces both possibilistic and probabilistic memberships simultaneously, and overcomes the noise sensitivity problem of FCM and the coincident clusters problem of PCA.
In order to start UPFC, an initialization step is required to build the initial cluster prototypes matrix and fuzzy membership degrees matrix. Although this task is usually performed in the initialization step of the clustering algorithm, the initial prototypes and memberships can also be directly input by the user.
UPFC is usually started by using an integer specifying the number of
clusters. In this case, the prototypes matrix is internally generated by
using any of the prototype initalization algorithms which are included
in the package ‘inaparc
’. The default initialization
technique is K-means++ with the current version of
fcm
function in this package. In the following code block,
FCM runs for three clusters with the default values of the remaining
arguments.
Although it is a usual way to run UPFC with a pre-determined number of clusters, sometimes the users may wish to use a certain cluster prototypes matrix to start the algorithm. In this case, UPFC uses the user-specified prototype matrix instead of internally generated ones as follows:
v0 <- matrix(nrow=3, ncol=4,
c(5.0, 3.4, 1.4, 0.3,
6.7, 3.0, 5.6, 2.1,
5.8, 2.7, 4.3, 1.4),
byrow=TRUE)
print(v0)
## [,1] [,2] [,3] [,4]
## [1,] 5.0 3.4 1.4 0.3
## [2,] 6.7 3.0 5.6 2.1
## [3,] 5.8 2.7 4.3 1.4
In the following code block, there is another example for
initialization of cluster prototypes for three clusters. v
,
the cluster prototype matrix is initialized by using the
K-means++ initalization algorithm (kmpp
) in the R
package ‘inaparc
’.
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cl.1 6.7 3.3 5.7 2.5
## Cl.2 4.9 2.5 4.5 1.7
## Cl.3 6.0 3.4 4.5 1.6
There are many other techniques for initialization of cluster prototype matrices in the R package ‘
inaparc
’. See the package documentation for other alternatives.
UPFC can be alternatively started with a user-specified membership
degrees matrix. In this case, the function fcm
is called
with the argument memberships
as follows:
In order to generate the matrices of cluster prototypes and
membership degrees, users can choose any of existing initialization
algorithms in the R package ‘inaparc
’. For this purpose,
alginitv
and alginitu
can be speficied for
cluster prototypes and membership degrees, respectively.
In general, the squared Euclidean distance metric is used with UPFC
in order to compute the distances between the cluster centers and the
data objects. Users can specify the other distance metrics with the
argument dmetric
as follows:
Although the argument m
, fuzzy exponent is usually
choosen as 2
in most of the applications using PFCM, users
can increase m
to get more fuzzified results as
follows:
However, large values of m
reduce the effect of
memberships on the prototypes and the model will behave more like the
PCM model (Pal et al, 2005). The argument eta
, typicality
exponent should be usually choosen as 2
for UPFC, but users
can change the eta
as follows in order to achieve the
different clustering results.
In UPFC, the relative importance of probabilistic and possibilistic
parts of the objective function can be changed by using a
and b
parameters, respectively. If b = 0, and Ωi = 0, UPFC
behaves like to FCM. Contrarily, if a = 0 UPFC becomes equivalent to
PCM. In general these arguments are set to 2
as the default
value, users can change them as follows:
There are other input arguments available with the function
upfc
to control the run of UPFC algoritm. For the details, see theupfc
section in the package manual ofppclust
.
The fuzzy membership degrees matrix is one of the main outputs of the
function upfc
.
## Cluster 1 Cluster 2 Cluster 3
## 1 0.996561530 0.0011900194 0.002248451
## 2 0.976425194 0.0080242351 0.015550571
## 3 0.980375517 0.0068097154 0.012814767
## 4 0.968135542 0.0108476143 0.021016844
## 5 0.994415765 0.0019437909 0.003640444
## 6 0.933424672 0.0228787449 0.043696583
## 7 0.979856490 0.0069778530 0.013165657
## 8 0.999594171 0.0001385057 0.000267323
## 9 0.931431194 0.0236180488 0.044950757
## 10 0.983234920 0.0056840799 0.011081000
## 11 0.967457882 0.0112969789 0.021245139
## 12 0.992326508 0.0026021081 0.005071384
## 13 0.971356883 0.0098011456 0.018841971
## 14 0.923893321 0.0270714763 0.049035203
## 15 0.888441329 0.0408412492 0.070717422
## 16 0.839111275 0.0590404394 0.101848285
## 17 0.946071278 0.0192236825 0.034705040
## 18 0.996506229 0.0012058544 0.002287917
## 19 0.902820747 0.0334387882 0.063740464
## 20 0.978725934 0.0074030106 0.013871055
## 21 0.968204703 0.0106107974 0.021184499
## 22 0.984368308 0.0053918403 0.010239851
## 23 0.958955571 0.0148345795 0.026209849
## 24 0.979138872 0.0068520927 0.014009036
## 25 0.967079883 0.0108198562 0.022100261
## 26 0.974036564 0.0086320452 0.017331391
## 27 0.994660950 0.0017918839 0.003547166
## 28 0.993134795 0.0023522507 0.004512954
## 29 0.993609033 0.0022008912 0.004190076
## 30 0.980011711 0.0067385356 0.013249753
## 31 0.979243489 0.0069527162 0.013803795
## 32 0.973887863 0.0088558399 0.017256297
## 33 0.937768618 0.0222304387 0.040000943
## 34 0.902881911 0.0352491553 0.061868934
## 35 0.985500383 0.0048975131 0.009602104
## 36 0.985346325 0.0051098332 0.009543842
## 37 0.963807406 0.0126824323 0.023510162
## 38 0.990995210 0.0031467439 0.005858046
## 39 0.940603399 0.0206770957 0.038719506
## 40 0.998246998 0.0005977477 0.001155254
## 41 0.994726795 0.0018386917 0.003434513
## 42 0.852253696 0.0509597253 0.096786578
## 43 0.953352931 0.0163202300 0.030326839
## 44 0.978866304 0.0071036336 0.014030062
## 45 0.944472346 0.0185219882 0.037005666
## 46 0.972739822 0.0092691687 0.017991009
## 47 0.976352024 0.0081772067 0.015470769
## 48 0.974830705 0.0086761485 0.016493146
## 49 0.976739822 0.0080667569 0.015193421
## 50 0.997258814 0.0009408408 0.001800345
## 51 0.037908226 0.5219165958 0.440175178
## 52 0.022886400 0.2235360864 0.753577513
## 53 0.024966891 0.6322740597 0.342759049
## 54 0.058910029 0.1175582529 0.823531718
## 55 0.018438625 0.2349626581 0.746598717
## 56 0.006928862 0.0324369676 0.960634171
## 57 0.022788045 0.3303244362 0.646887519
## 58 0.298149158 0.1601404534 0.541710389
## 59 0.025163684 0.2674972747 0.707339041
## 60 0.085511993 0.1319423775 0.782545630
## 61 0.229484196 0.1765508944 0.593964910
## 62 0.009941707 0.0407674417 0.949290852
## 63 0.061432849 0.1350750795 0.803492071
## 64 0.007605932 0.0789718101 0.913422258
## 65 0.103408466 0.1259833633 0.770608171
## 66 0.035027707 0.2915931793 0.673379113
## 67 0.014135303 0.0696823367 0.916182361
## 68 0.032954302 0.0762927169 0.890752981
## 69 0.025355230 0.1665346936 0.808110076
## 70 0.063036079 0.1054705311 0.831493390
## 71 0.021628220 0.2891281914 0.689243588
## 72 0.022568957 0.0676723947 0.909758649
## 73 0.018777003 0.3059656090 0.675257388
## 74 0.010368643 0.0841605873 0.905470770
## 75 0.019369459 0.1117633031 0.868867238
## 76 0.028009187 0.2300180226 0.741972790
## 77 0.027032774 0.4771593649 0.495807861
## 78 0.013920771 0.7457360224 0.240343206
## 79 0.002113249 0.0155404741 0.982346277
## 80 0.141896081 0.1376634164 0.720440503
## 81 0.090512370 0.1260093458 0.783478284
## 82 0.117350545 0.1359901396 0.746659315
## 83 0.040033186 0.0804687601 0.879498054
## 84 0.018258770 0.3722683083 0.609472922
## 85 0.027452233 0.1108798682 0.861667899
## 86 0.026785120 0.1922191994 0.780995680
## 87 0.026248103 0.4483512270 0.525400670
## 88 0.025542869 0.1401895051 0.834267626
## 89 0.030159821 0.0740539017 0.895786278
## 90 0.048313901 0.0974374966 0.854248602
## 91 0.024734463 0.0783140926 0.896951445
## 92 0.007262196 0.0636138929 0.929123912
## 93 0.030694401 0.0709285736 0.898377026
## 94 0.282129744 0.1613516206 0.556518636
## 95 0.019280744 0.0547988930 0.925920363
## 96 0.021105535 0.0600460860 0.918848379
## 97 0.014202904 0.0436281289 0.942168968
## 98 0.009545495 0.0492160656 0.941238440
## 99 0.367926454 0.1487732423 0.483300303
## 100 0.019334922 0.0515549246 0.929110154
## 101 0.021561440 0.8322706697 0.146167890
## 102 0.023257778 0.4178205705 0.558921651
## 103 0.013274864 0.8953346435 0.091390492
## 104 0.007540235 0.8950182539 0.097441511
## 105 0.005994564 0.9413754552 0.052629980
## 106 0.045148318 0.7473215638 0.207530118
## 107 0.074705088 0.2089274508 0.716367461
## 108 0.030217115 0.7981662578 0.171616627
## 109 0.014429578 0.8519547777 0.133615644
## 110 0.033079124 0.7995131461 0.167407730
## 111 0.008983526 0.8591802017 0.131836272
## 112 0.008501899 0.8514987187 0.139999383
## 113 0.001660047 0.9823028612 0.016037092
## 114 0.029249224 0.3599067575 0.610844018
## 115 0.031014745 0.5611173883 0.407867866
## 116 0.008795689 0.8949841338 0.096220177
## 117 0.002739029 0.9622238289 0.035037143
## 118 0.060179221 0.7048720132 0.234948765
## 119 0.057920996 0.7013758843 0.240703119
## 120 0.028117183 0.2974764009 0.674406416
## 121 0.008732798 0.9265566705 0.064710532
## 122 0.028773113 0.3088202524 0.662406635
## 123 0.051105595 0.7224817392 0.226412666
## 124 0.016276663 0.4514248862 0.532298451
## 125 0.005577520 0.9480415074 0.046380973
## 126 0.020576075 0.8483919361 0.131031989
## 127 0.015167985 0.3142799902 0.670552024
## 128 0.016547551 0.3892322765 0.594220172
## 129 0.005132865 0.9375654308 0.057301704
## 130 0.019534890 0.8393856957 0.141079414
## 131 0.027818303 0.8086596688 0.163522028
## 132 0.060195620 0.7017049077 0.238099472
## 133 0.006164155 0.9285344931 0.065301352
## 134 0.016701767 0.5031547680 0.480143465
## 135 0.025529819 0.6148715375 0.359598644
## 136 0.038000307 0.7744157667 0.187583926
## 137 0.015601257 0.8556291045 0.128769639
## 138 0.004621692 0.9354727876 0.059905521
## 139 0.016125648 0.2615512695 0.722323083
## 140 0.004041572 0.9582128488 0.037745579
## 141 0.006937924 0.9360352813 0.057026794
## 142 0.012787074 0.8665680026 0.120644924
## 143 0.023257778 0.4178205705 0.558921651
## 144 0.011007326 0.9113418716 0.077650802
## 145 0.013098082 0.8932290278 0.093672890
## 146 0.007362117 0.9140759398 0.078561944
## 147 0.019017721 0.5423114187 0.438670860
## 148 0.004549887 0.9267063736 0.068743739
## 149 0.016542131 0.8215558249 0.161902045
## 150 0.020068950 0.4605309274 0.519400122
The typicality degrees matrix of the function upfc
.
## Cluster 1 Cluster 2 Cluster 3
## 1 9.797503e-01 3.628715e-08 1.153879e-04
## 2 8.663850e-01 2.632576e-08 1.227010e-04
## 3 8.784034e-01 7.830448e-09 4.924827e-05
## 4 8.200776e-01 2.049583e-08 1.075846e-04
## 5 9.664585e-01 2.629939e-08 8.967697e-05
## 6 6.992044e-01 4.571315e-07 4.791942e-04
## 7 8.787184e-01 1.303657e-08 6.622221e-05
## 8 9.976897e-01 5.630194e-08 1.753447e-04
## 9 6.181088e-01 5.756702e-09 4.684103e-05
## 10 9.057381e-01 3.650009e-08 1.530292e-04
## 11 8.289702e-01 1.056292e-07 1.951812e-04
## 12 9.573522e-01 6.048045e-08 1.978217e-04
## 13 8.338561e-01 1.512230e-08 8.551121e-05
## 14 5.321662e-01 4.472613e-10 6.891896e-06
## 15 4.431401e-01 2.046545e-08 3.625801e-05
## 16 3.209972e-01 9.686272e-08 8.592998e-05
## 17 7.075471e-01 4.035360e-08 8.021927e-05
## 18 9.797999e-01 4.742553e-08 1.379962e-04
## 19 5.903425e-01 6.606793e-07 5.726835e-04
## 20 8.824129e-01 6.568517e-08 1.467802e-04
## 21 8.517921e-01 4.396839e-07 6.546431e-04
## 22 9.152162e-01 9.452037e-08 2.000926e-04
## 23 7.206164e-01 6.331879e-10 6.219220e-06
## 24 9.037552e-01 5.245906e-07 8.476990e-04
## 25 8.463095e-01 3.330849e-07 6.741699e-04
## 26 8.679314e-01 1.144765e-07 3.490078e-04
## 27 9.723347e-01 1.724431e-07 3.832027e-04
## 28 9.621480e-01 8.406454e-08 2.051886e-04
## 29 9.633849e-01 4.856376e-08 1.440097e-04
## 30 8.907718e-01 4.946996e-08 1.925313e-04
## 31 8.893543e-01 6.722407e-08 2.439815e-04
## 32 8.701156e-01 2.265706e-07 3.889786e-04
## 33 6.637457e-01 3.099715e-08 6.715342e-05
## 34 5.107845e-01 3.362922e-08 5.523035e-05
## 35 9.197048e-01 4.843698e-08 1.858254e-04
## 36 9.085398e-01 9.275284e-09 5.003298e-05
## 37 8.000797e-01 4.350783e-08 1.068843e-04
## 38 9.444681e-01 1.533933e-08 6.345702e-05
## 39 6.500612e-01 3.099321e-09 2.858532e-05
## 40 9.901972e-01 7.164000e-08 2.009737e-04
## 41 9.677499e-01 1.985658e-08 7.527078e-05
## 42 3.137494e-01 3.809089e-09 3.691169e-05
## 43 7.147550e-01 3.023651e-09 2.601912e-05
## 44 8.956909e-01 2.555606e-07 4.593186e-04
## 45 7.601997e-01 8.477551e-07 9.140970e-04
## 46 8.467572e-01 2.622770e-08 1.241825e-04
## 47 8.730722e-01 9.150310e-08 1.904176e-04
## 48 8.494158e-01 1.086762e-08 6.466106e-05
## 49 8.743481e-01 8.690076e-08 1.782637e-04
## 50 9.838516e-01 3.203309e-08 1.212013e-04
## 51 6.176213e-06 4.184427e-01 3.559369e-01
## 52 6.308434e-05 3.715193e-01 7.454907e-01
## 53 2.417373e-06 6.000847e-01 3.898320e-01
## 54 1.099977e-03 3.291526e-02 6.142711e-01
## 55 2.464312e-05 4.348752e-01 7.694661e-01
## 56 2.137540e-04 1.644496e-01 9.408674e-01
## 57 2.515513e-05 4.816191e-01 6.886157e-01
## 58 2.374708e-02 9.456154e-04 1.276323e-01
## 59 3.009748e-05 3.755447e-01 6.904752e-01
## 60 2.772881e-03 2.201715e-02 5.255070e-01
## 61 6.365189e-03 1.397502e-03 1.417362e-01
## 62 5.123974e-04 1.576130e-01 9.237202e-01
## 63 7.853314e-04 3.871274e-02 5.789007e-01
## 64 4.392086e-05 3.804845e-01 9.198503e-01
## 65 8.747104e-03 2.044846e-02 5.294407e-01
## 66 5.634986e-05 3.087272e-01 6.011332e-01
## 67 1.942336e-04 1.766338e-01 8.764648e-01
## 68 1.453093e-03 5.946551e-02 7.852649e-01
## 69 3.170269e-05 2.065538e-01 7.225078e-01
## 70 2.681084e-03 2.903958e-02 6.383200e-01
## 71 1.873469e-05 4.429662e-01 7.106525e-01
## 72 1.020540e-03 1.005623e-01 8.429390e-01
## 73 5.972678e-06 4.779861e-01 7.157148e-01
## 74 5.553507e-05 2.990389e-01 8.938622e-01
## 75 1.850323e-04 2.254679e-01 8.256322e-01
## 76 6.858598e-05 3.111575e-01 6.963370e-01
## 77 5.210605e-06 5.019875e-01 5.151700e-01
## 78 1.545970e-06 7.789847e-01 4.607192e-01
## 79 1.111668e-04 2.899464e-01 9.806048e-01
## 80 1.211570e-02 1.057835e-02 4.192773e-01
## 81 3.614066e-03 1.761616e-02 5.222570e-01
## 82 5.771523e-03 1.169879e-02 4.447825e-01
## 83 2.418250e-03 4.992207e-02 7.601541e-01
## 84 3.628143e-06 5.409623e-01 6.870960e-01
## 85 2.261971e-04 1.251481e-01 7.653430e-01
## 86 1.112588e-04 2.812351e-01 7.318206e-01
## 87 1.152071e-05 5.139030e-01 5.666046e-01
## 88 6.986152e-05 1.749082e-01 7.460408e-01
## 89 1.540480e-03 7.155187e-02 8.041045e-01
## 90 1.497341e-03 3.975546e-02 6.922199e-01
## 91 3.784773e-04 8.302702e-02 8.047028e-01
## 92 7.640966e-05 3.388582e-01 9.285856e-01
## 93 1.477472e-03 5.958090e-02 8.003729e-01
## 94 2.035540e-02 1.103212e-03 1.388600e-01
## 95 7.931436e-04 8.110561e-02 8.618550e-01
## 96 1.081521e-03 9.067680e-02 8.548169e-01
## 97 8.655277e-04 1.006812e-01 8.991465e-01
## 98 2.750378e-04 2.039001e-01 9.202173e-01
## 99 5.225403e-02 6.758061e-04 1.057137e-01
## 100 1.193825e-03 8.012153e-02 8.693020e-01
## 101 9.902821e-10 5.844256e-01 4.696466e-02
## 102 2.403417e-06 4.866442e-01 5.836813e-01
## 103 7.629014e-10 7.325159e-01 4.738481e-02
## 104 8.682314e-08 8.719876e-01 2.841687e-01
## 105 5.770510e-09 8.862095e-01 1.152393e-01
## 106 7.814410e-13 1.855955e-01 2.323225e-03
## 107 1.014493e-04 3.732291e-02 3.832824e-01
## 108 4.724574e-11 4.065278e-01 1.520304e-02
## 109 6.222786e-09 7.261303e-01 1.299590e-01
## 110 4.389543e-11 3.727903e-01 8.982182e-03
## 111 7.726375e-07 8.631636e-01 3.832810e-01
## 112 2.825781e-07 8.602250e-01 4.002211e-01
## 113 2.442391e-08 9.708134e-01 1.629448e-01
## 114 2.798208e-06 3.537562e-01 5.421236e-01
## 115 6.243886e-07 4.539991e-01 3.374421e-01
## 116 1.299407e-07 8.557040e-01 2.346999e-01
## 117 1.130669e-07 9.554895e-01 2.863812e-01
## 118 1.798830e-13 8.163583e-02 5.439053e-04
## 119 1.778672e-14 7.319913e-02 4.912765e-04
## 120 3.663743e-06 3.063285e-01 5.934177e-01
## 121 3.180480e-09 8.315933e-01 7.132581e-02
## 122 7.429094e-06 3.327512e-01 5.986978e-01
## 123 2.669888e-13 1.290025e-01 1.451855e-03
## 124 4.031564e-06 6.389898e-01 6.839837e-01
## 125 1.022891e-08 8.974127e-01 1.094325e-01
## 126 6.652694e-10 5.990042e-01 3.621819e-02
## 127 9.020011e-06 5.708538e-01 7.689286e-01
## 128 7.513705e-06 6.055578e-01 7.199549e-01
## 129 2.980833e-08 9.094932e-01 2.117777e-01
## 130 3.625107e-09 6.361528e-01 6.780187e-02
## 131 1.001933e-10 4.529224e-01 1.990429e-02
## 132 1.369464e-12 9.600554e-02 1.001652e-03
## 133 2.231032e-08 8.896208e-01 1.895542e-01
## 134 2.891668e-06 6.548515e-01 6.416989e-01
## 135 2.107556e-07 5.282013e-01 3.357528e-01
## 136 1.179899e-11 2.909104e-01 6.112238e-03
## 137 1.949681e-08 7.234654e-01 1.163805e-01
## 138 1.490243e-07 9.252787e-01 2.973849e-01
## 139 1.474194e-05 5.036429e-01 7.800805e-01
## 140 3.565793e-08 9.302214e-01 1.594150e-01
## 141 7.255813e-09 8.703043e-01 1.022739e-01
## 142 1.103873e-07 7.894804e-01 1.830728e-01
## 143 2.403417e-06 4.866442e-01 5.836813e-01
## 144 1.129189e-09 7.797115e-01 5.391285e-02
## 145 2.929266e-09 7.496710e-01 6.409364e-02
## 146 1.033545e-07 8.784889e-01 2.214961e-01
## 147 1.452980e-06 6.241410e-01 5.583624e-01
## 148 4.015256e-07 9.302419e-01 3.772716e-01
## 149 1.107363e-07 7.243457e-01 1.946746e-01
## 150 3.483438e-06 5.782990e-01 6.153330e-01
Initial and final cluster prototypes matrices can be achieved as follows:
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 5.1 3.3 1.7 0.5
## Cluster 2 6.9 3.1 5.4 2.1
## Cluster 3 5.5 2.5 4.0 1.3
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 5.000576 3.411018 1.480558 0.2503315
## Cluster 2 6.629620 3.018968 5.478627 2.0051523
## Cluster 3 5.944440 2.791643 4.429674 1.4231306
The function upfc
returns the clustering results as an
intance of ‘ppclust
’ class. This object is summarized with
the summary
method of the package ‘ppclust
’ as
follows:
## Summary for 'res.upfc'
##
## Number of data objects: 150
##
## Number of clusters: 3
##
## Crisp 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 2 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
## [75] 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 2 2 2 2 3 2 2 2 2
## [112] 2 2 3 2 2 2 2 2 3 2 3 2 3 2 2 3 3 2 2 2 2 2 2 2 2 2 2 3 2 2 2 3 2 2 2 2 2
## [149] 2 3
##
## Initial cluster prototypes:
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 5.1 3.3 1.7 0.5
## Cluster 2 6.9 3.1 5.4 2.1
## Cluster 3 5.5 2.5 4.0 1.3
##
## Final cluster prototypes:
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 5.000576 3.411018 1.480558 0.2503315
## Cluster 2 6.629620 3.018968 5.478627 2.0051523
## Cluster 3 5.944440 2.791643 4.429674 1.4231306
##
## Distance between the final cluster prototypes
## Cluster 1 Cluster 2
## Cluster 2 21.871439
## Cluster 3 11.347243 1.960201
##
## Difference between the initial and final cluster prototypes
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 -0.09942436 0.11101804 -0.21944160 -0.24966846
## Cluster 2 -0.27037990 -0.08103174 0.07862714 -0.09484766
## Cluster 3 0.44443996 0.29164324 0.42967357 0.12313065
##
## Root Mean Squared Deviations (RMSD): 0.4864539
## Mean Absolute Deviation (MAD): 3.324435
##
## Membership degrees matrix (top and bottom 5 rows):
## Cluster 1 Cluster 2 Cluster 3
## 1 0.9797503 3.6e-08 0.000115388
## 2 0.8663850 2.6e-08 0.000122701
## 3 0.8784034 8.0e-09 0.000049248
## 4 0.8200776 2.0e-08 0.000107585
## 5 0.9664585 2.6e-08 0.000089677
## ...
## Cluster 1 Cluster 2 Cluster 3
## 146 1.030e-07 0.8784889 0.2214961
## 147 1.453e-06 0.6241410 0.5583624
## 148 4.020e-07 0.9302419 0.3772716
## 149 1.110e-07 0.7243457 0.1946746
## 150 3.483e-06 0.5782990 0.6153330
##
## Descriptive statistics for the membership degrees by clusters
## Size Min Q1 Mean Median Q3 Max
## Cluster 1 50 0.31374943 0.7305122 0.8161604 0.8715939 0.9185827 0.9976897
## Cluster 2 42 0.07319913 0.4725497 0.6552011 0.7293231 0.8715668 0.9708134
## Cluster 3 58 0.10571370 0.5836813 0.6754658 0.7131837 0.8045532 0.9806048
##
## Dunn's Fuzziness Coefficients:
## dunn_coeff normalized
## 0.6169534 0.4254301
##
## Within cluster sum of squares by cluster:
## 1 2 3
## 15.15100 29.10857 35.21241
## (between_SS / total_SS = 87.52%)
##
## Available components:
## [1] "u" "t" "v" "v0" "d"
## [6] "x" "cluster" "csize" "sumsqrs" "k"
## [11] "m" "eta" "a" "b" "beta"
## [16] "iter" "best.start" "func.val" "comp.time" "inpargs"
## [21] "algorithm" "call"
All available components of the ‘ppclust
’ object are
listed at the end of summary. These elements can be accessed using as
the attributes of the object. For example, the execution time of the run
of UPFC is accessed as follows:
## [1] 0.378
In order to find an optimal solution, the function upfc
can be started for multiple times. As seen in the following code chunk,
the argument nstart
is used for this purpose.
When the multiple start is performed, either initial cluster
prototypes or initial membership degrees could be wanted to keep
unchanged between the starts of algorithm. In this case, the arguments
fixcent
and fixmemb
are used for fixing the
initial cluster prototypes matrix and initial membership degrees matrix,
respectively.
Both the prototypes and memberships cannot be fixed at the same time.
The clustering result contains some outputs providing information about some components such as the objective function values, number of iterations and computing time obtained with each start of the algorithm. The following code chunk demonstrates these outputs.
## [1] -186.3218 -186.3218 -186.3218 -186.3218
## [1] 53 59 61 59
## [1] 0.350 0.410 0.400 0.388
Among the outputs from succesive starts of the algorithm, the best solution is obtained from the start giving the minimum value of the objective function, and stored as the final clustering result of the multiple starts of UPFC.
## [1] 2
As described for the single start of UPFC above, the result of
multiple starts of UPFC is displayed by using summary
method of the ‘ppclust
’ package.
## Summary for 'res.upfc'
##
## Number of data objects: 150
##
## Number of clusters: 3
##
## Crisp clustering vector:
## [1] 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 2 2 2 2 2 2 2 2 2 2 2
## [38] 2 2 2 2 2 2 2 2 2 2 2 2 2 1 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
## [75] 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 3 1 1 1 1 3 1 1 1 1
## [112] 1 1 3 1 1 1 1 1 3 1 3 1 3 1 1 3 3 1 1 1 1 1 1 1 1 1 1 3 1 1 1 3 1 1 1 1 1
## [149] 1 3
##
## Initial cluster prototypes:
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 6.3 2.9 5.6 1.8
## Cluster 2 4.4 3.0 1.3 0.2
## Cluster 3 5.0 2.3 3.3 1.0
##
## Final cluster prototypes:
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 6.629620 3.018968 5.478627 2.0051523
## Cluster 2 5.000576 3.411018 1.480558 0.2503315
## Cluster 3 5.944440 2.791643 4.429674 1.4231306
##
## Distance between the final cluster prototypes
## Cluster 1 Cluster 2
## Cluster 2 21.871439
## Cluster 3 1.960201 11.347243
##
## Difference between the initial and final cluster prototypes
## Sepal.Length Sepal.Width Petal.Length Petal.Width
## Cluster 1 0.3296201 0.1189683 -0.1213729 0.20515234
## Cluster 2 0.6005756 0.4110180 0.1805584 0.05033154
## Cluster 3 0.9444400 0.4916432 1.1296736 0.42313065
##
## Root Mean Squared Deviations (RMSD): 1.054082
## Mean Absolute Deviation (MAD): 6.675313
##
## Membership degrees matrix (top and bottom 5 rows):
## Cluster 1 Cluster 2 Cluster 3
## 1 3.6e-08 0.9797503 0.000115388
## 2 2.6e-08 0.8663850 0.000122701
## 3 8.0e-09 0.8784034 0.000049248
## 4 2.0e-08 0.8200776 0.000107585
## 5 2.6e-08 0.9664585 0.000089677
## ...
## Cluster 1 Cluster 2 Cluster 3
## 146 0.8784889 1.030e-07 0.2214961
## 147 0.6241410 1.453e-06 0.5583624
## 148 0.9302419 4.020e-07 0.3772716
## 149 0.7243457 1.110e-07 0.1946746
## 150 0.5782990 3.483e-06 0.6153330
##
## Descriptive statistics for the membership degrees by clusters
## Size Min Q1 Mean Median Q3 Max
## Cluster 1 42 0.07319913 0.4725497 0.6552011 0.7293231 0.8715668 0.9708134
## Cluster 2 50 0.31374943 0.7305122 0.8161604 0.8715939 0.9185827 0.9976897
## Cluster 3 58 0.10571370 0.5836813 0.6754658 0.7131837 0.8045532 0.9806048
##
## Dunn's Fuzziness Coefficients:
## dunn_coeff normalized
## 0.6169534 0.4254301
##
## Within cluster sum of squares by cluster:
## 1 2 3
## 29.10857 15.15100 35.21241
## (between_SS / total_SS = 87.52%)
##
## Available components:
## [1] "u" "t" "v" "v0" "d"
## [6] "x" "cluster" "csize" "sumsqrs" "k"
## [11] "m" "eta" "a" "b" "beta"
## [16] "iter" "best.start" "func.val" "comp.time" "inpargs"
## [21] "algorithm" "call"
There are many ways of visual representation of the clustering
results. One common techique is to display the clustering results by
using pairs of the features. The ‘plotcluster
’ can be used
to plot the clustering results as follows:
In the above figure, the plot shows the data objects which have
typicality degrees than 0.5 by using the color palette 1 and transparent
colors. In order to filter the objects for different typicality degrees,
the value of tv
argument can be changed as follows:
As default, the function plotcluster
plots for the
typicality degrees for the algorithm producing both fuzzy membership and
typicality degrees such as FPCM and PFCM including UPFC. In order to
plot using the fuzzy memberships, the argument mt
, the
membership type should be used with “u” option as follows:
There are some nice versions of the cluster plots in some of the R
packages. One of them is the function fviz_cluster
of the
package ‘factoextra
’ (Kassambara & Mundt, 2017). In
order to use this function for the fuzzy clustering result, first the
fuzzy clustering object of ppclust
should be converted to
kmeans
object by using the function ppclust2
of the package ‘ppclust
’ as shown in the first line of the
code chunk below:
User can also use the function clusplot
in the package
‘cluster
’ (Maechler et al, 2017) for plotting the
clustering results. For this purpose, the fuzzy clustering object of
ppclust
should be converted to fanny
object by
using the ppclust2
function of the package
‘ppclust
’ as seen in the following code chunk.
Cluster validation is an evaluation process for the goodness of the
clustering result. For this purpose, various validity indexes have been
proposed in the related literature. Since clustering is an unsupervised
learning analysis which does not use any external information, the
internal indexes are used to validate the clustering results. Although
there are many internal indexes have originally been proposed for
working with hard membership degrees produced by the K-means and its
variants, most of these indexes cannot be used for fuzzy clustering
results. In R environment, Partition Entropy (PE), Partition Coefficient
(PC) and Modified Partition Coefficient (MPC) and Fuzzy Silhouette Index
are available in ‘fclust
’ package (Ferraro & Giordani,
2015), and can be used as follows:
res.upfc4 <- ppclust2(res.upfc, "fclust")
idxsf <- SIL.F(res.upfc4$Xca, res.upfc4$U, alpha=1)
idxpe <- PE(res.upfc4$U)
idxpc <- PC(res.upfc4$U)
idxmpc <- MPC(res.upfc4$U)
## Partition Entropy: 0.3614377
## Partition Coefficient: 0.6169534
## Modified Partition Coefficient: 0.4254301
## Fuzzy Silhouette Index: 0.8262374
Anderson, E. (1935). The irises of the GASPE peninsula, in Bull. Amer. Iris Soc., 59: 2-5.
Ferraro, M.B. & Giordani, P. (2015). A toolbox for fuzzy clustering using the R programming language. Fuzzy Sets and Systems, 279, 1-16. http://dx.doi.org/10.1016/j.fss.2015.05.001
Kassambara, A. & Mundt, F. (2017). factoextra: Extract and Visualize the Results of Multivariate Data Analyses. R package version 1.0.5. https://CRAN.R-project.org/package=factoextra
Maechler, M., Rousseeuw, P., Struyf, A., Hubert, M. & Hornik, K.(2017). cluster: Cluster Analysis Basics and Extensions. R package version 2.0.6. https://CRAN.R-project.org/package=cluster
Pal, N. R., Pal, K. & Bezdek, J. C. (2005). A possibilistic fuzzy c-means clustering algorithm. IEEE Trans. Fuzzy Systems, 13 (4): 517-530
Yang, M. S. & Wu, K. L. (2006). Unsupervised possibilistic clustering. Pattern Recognition, 39(1): 5-21.
Wu, X., Wu, B., Sun, J. & Fu, H. (2010). Unsupervised possibilistic fuzzy clustering. J. of Information & Computational Sci., 7 (5): 1075-1080.