R/silhouette.R
maximiseSilhouette.Rd
Choose the number of clusters K that maximises the silhouette, starting from a set of kernel matrices each corresponding to a different choice of K and the corresponding clusterings of the data for each of those values of K.
maximiseSilhouette( kernelMatrix, clLabels, maxK, savePNG = FALSE, fileName = "silhouette", isDistance = FALSE, widestGap = FALSE, dunns = FALSE, dunn2s = FALSE )
kernelMatrix | N X N X (maxK-1) array of kernel matrices. |
---|---|
clLabels | (maxK-1) X N matrix containing the clusterings obtained for different values of K. |
maxK | Maximum number of clusters considered. |
savePNG | If TRUE, a plot of the silhouette is saved in the working folder. Defaults to FALSE. |
fileName | If |
isDistance | Boolean. If TRUE, the kernel matrices are interpreted as matrices of distances, otherwise as matrices of similarities. |
widestGap | Boolean. If TRUE, also computes widest gap index (and plots
it if |
dunns | Boolean. If TRUE, also computes Dunn's index: minimum separation
/ maximum diameter (and plots it if |
dunn2s | Boolean. If TRUE, also computes an alternative version
of Dunn's index: minimum average dissimilarity between two cluster / maximum
average within cluster dissimilarity (and plots it if |
The function returns a list containing:
a vector of length maxK-1
such that silh[i]
is the
silhouette for K = i+1
the lowest number of clusters for which the silhouette is maximised.