Compute Bayesian cluster validity index (BCVI) from two to kmax groups using all or part of GC1 GC2 GC3 and GC4 as the underling cluster validity index (CVI) with the user's selected Dirichlet prior parameters. The full detail of BCVI can be found in the paper Wiroonsri and Preedasawakul (2024).
B_GC.IDX(x, kmax, indexlist = "all", method = "FCM", fzm = 2, iter = 100,
nstart = 20, alpha = "default", mult.alpha = 1/2)
the dataframe where the first and the second columns are the number of groups k and BCVI\((k)\), respectively, for k from 2 to kmax.
the data frame where the first and the second columns are the number of groups k and the variance of \(p_k\), respectively, for k from 2 to kmax.
the data frame where the first and the second columns are the number of groups k and the original GC1\((k)\) GC2\((k)\) GC3\((k)\) GC4\((k)\), respectively, for k from 2 to kmax.
a numeric data frame or matrix where each column is a variable to be used for cluster analysis and each row is a data point.
a maximum number of clusters to be considered.
a character string indicating which The generalized C index be computed ("all","GC1","GC2","GC3","GC4"). More than one indexes can be selected.
a character string indicating which clustering method to be used ("FCM" or "EM"). The default is "FCM".
a number greater than 1 giving the degree of fuzzification for method = "FCM". The default is 2.
a maximum number of iterations for method = "FCM". The default is 100.
a maximum number of initial random sets for FCM for method = "FCM". The default is 20.
Dirichlet prior parameters \(\alpha_2,...,\alpha_k\) where \(\alpha_k\) is the parameter corresponding to "the probability of having k groups" (selecting each \(\alpha_k\) between 0 to 30 is recommended and using the other parameter mult.alpha to be its multiplier. The default is "default".)
the power \(s\) from \(n^s\) to be multiplied to the Dirichlet prior parameters alpha (selecting mult.alpha in [0,1) is recommended). The default is \(\frac{1}{2}\).
Nathakhun Wiroonsri and Onthada Preedasawakul
BCVI-GC is defined as follows.
Let
$$r_k(\bf x) = \dfrac{\max_j CVI(j)- CVI(k)}{\sum_{i=2}^K (\max_j CVI(j) - CVI(i))}.$$
where CVI is one of the GC1 GC2 GC3 or GC4 index.
Assume that
$$f({\bf x}|{\bf p}) = C({\bf p}) \prod_{k=2}^Kp_k^{nr_k(x)}$$
represents the conditional probability density function of the dataset given \(\bf p\), where \(C({\bf p})\) is the normalizing constant. Assume further that \({\bf p}\) follows a Dirichlet prior distribution with parameters \({\bm \alpha} = (\alpha_2,\ldots,\alpha_K)\). The posterior distribution of \(\bf p\) still remains a Dirichlet distribution with parameters \((\alpha_2+nr_2({\bf x}),\ldots,\alpha_K+nr_K({\bf x}))\).
The BCVI is then defined as
$$BCVI(k) = E[p_k|{\bf x}] = \frac{\alpha_k + nr_k({\bf x})}{\alpha_0+n}$$
where \(\alpha_0 = \sum_{k=2}^K \alpha_k.\)
The variance of \(p_k\) can be computed as $$Var(p_k|{\bf x}) = \dfrac{(\alpha_k + nr_k(x))(\alpha_0 + n -\alpha_k-nr_k(x))}{(\alpha_0 + n)^2(\alpha_0 + n +1 )}.$$
J. C. Bezdek, M. Moshtaghi, T. Runkler, and C. Leckie, “The generalized c index for internal fuzzy cluster validity,” IEEE Transactions on Fuzzy Systems, vol. 24, no. 6, pp. 1500–1512, 2016. https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=7429723&isnumber=7797168
O. Preedasawakul, and N. Wiroonsri, A Bayesian Cluster Validity Index, Computational Statistics & Data Analysis, 202, 108053, 2025. tools:::Rd_expr_doi("10.1016/j.csda.2024.108053")
B7_data, B_TANG.IDX, B_XB.IDX, B_Wvalid, B_DB.IDX
library(BayesCVI)
# The data included in this package.
data = B7_data[,1:2]
# alpha
aalpha = c(5,5,5,20,20,20,0.5,0.5,0.5)
B.GC = B_GC.IDX(x = scale(data), kmax = 10, indexlist = "GC1",
method = "FCM", fzm = 2, iter = 100,
nstart = 20, alpha = aalpha, mult.alpha = 1/2)
# plot the BCVI-GC1
pplot = plot_BCVI(B.GC$GC1)
pplot$plot_index
pplot$plot_BCVI
pplot$error_bar_plot
Run the code above in your browser using DataLab