Calculate the Negentropy Increment index of clustering quality.
calcNegentropyI(data, belongmatrix, centers)
The original dataframe used for the clustering (n*p)
A membership matrix (n*k)
The centres of the clusters
A float: the Negentropy Increment index
The Negentropy Increment index (Da Silva et al. 2020) is based on the assumption that a normally shaped cluster is more desirable. It uses the difference between the average negentropy of all the clusters in the partition, and that of the whole partition. A smaller value indicates a better partition. The formula is:
$$NI=\frac{1}{2} \sum_{j=1}^{k} p_{i} \ln \left|{\boldsymbol{\Sigma}}_{j}\right|-\frac{1}{2} \ln \left|\boldsymbol{\Sigma}_{d a t a}\right|-\sum_{j=1}^{k} p_{j} \ln p_{j}$$
with a cluster, |.| the determinant of a matrix,
j a cluster
|.| the determinant of a matrix
\(\left|{\boldsymbol{\Sigma}}_{j}\right|\) the covariance matrix of the dataset weighted by the membership values to cluster j
\(\left|\boldsymbol{\Sigma}_{d a t a}\right|\) the covariance matrix of the dataset
\(p_{j}\) the sum of the membership values to cluster j divided by the number of observations.
Da Silva LEB, Melton NM, Wunsch DC (2020). “Incremental cluster validity indices for online learning of hard partitions: Extensions and comparative study.” IEEE Access, 8, 22025--22047.
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)
calcNegentropyI(result$Data, result$Belongings, result$Centers)