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
)
N X N X (maxK-1) array of kernel matrices.
(maxK-1) X N matrix containing the clusterings obtained for different values of K.
Maximum number of clusters considered.
If TRUE, a plot of the silhouette is saved in the working folder. Defaults to FALSE.
If savePNG
is TRUE, this is the name of the png file.
Boolean. If TRUE, the kernel matrices are interpreted as matrices of distances, otherwise as matrices of similarities.
Boolean. If TRUE, also computes widest gap index (and plots
it if savePNG
is TRUE).
Boolean. If TRUE, also computes Dunn's index: minimum separation
/ maximum diameter (and plots it if savePNG
is TRUE).
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 savePNG
is
TRUE).
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.