View source: R/clustering_evaluation.R
calcGD43 | R Documentation |
Calculate the Generalized Dunn’s index (v43) of clustering quality.
calcGD43(data, belongmatrix, centers)
data |
The original dataframe used for the clustering (n*p) |
belongmatrix |
A membership matrix (n*k) |
centers |
The centres of the clusters |
The Generalized Dunn’s index \insertCiteda2020incrementalgeocmeans is a ratio of the worst pair-wise separation of clusters and the worst compactness of clusters. A higher value indicates a better clustering. The formula is:
GD_{r s}=\frac{\min_{i \neq j}\left[\delta_{r}\left(\omega_{i}, \omega_{j}\right)\right]}{\max_{k}\left[\Delta_{s}\left(\omega_{k}\right)\right]}
The numerator is a measure of the minimal separation between all the clusters i and j given by the formula:
\delta_{r}\left(\omega_{i}, \omega_{j}\right)=\left\|\boldsymbol{c}_{i}-\boldsymbol{c}_{j}\right\|
which is basically the Euclidean distance between the centres of clusters c_{i}
and c_{j}
The denominator is a measure of the maximal dispersion of all clusters, given by the formula:
\frac{2*\sum_{l=1}^{n}\left\|\boldsymbol{x}_{l}-\boldsymbol{c_{i}}\right\|^{\frac{1}{2}}}{\sum{u_{i}}}
A float: the Generalized Dunn’s index (43)
data(LyonIris)
AnalysisFields <-c("Lden","NO2","PM25","VegHautPrt","Pct0_14","Pct_65","Pct_Img",
"TxChom1564","Pct_brevet","NivVieMed")
dataset <- sf::st_drop_geometry(LyonIris[AnalysisFields])
queen <- spdep::poly2nb(LyonIris,queen=TRUE)
Wqueen <- spdep::nb2listw(queen,style="W")
result <- SFCMeans(dataset, Wqueen,k = 5, m = 1.5, alpha = 1.5, standardize = TRUE)
calcGD43(result$Data, result$Belongings, result$Centers)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.