nmfkc.criterion computes information criteria (ICp, AIC, BIC),
clustering quality measures (silhouette, CPCC, dist.cor), and
soft-clustering statistics (B.prob entropy, max, sd) from a fitted
nmfkc model.
This function can be called on a model that was fitted with
detail = "fast" or detail = "minimal" to compute the
full set of criteria afterwards.
Usage
nmfkc.criterion(object, Y, detail = c("full", "fast", "minimal"), ...)Arguments
- object
An object of class
"nmfkc"returned bynmfkc.- Y
The original observation matrix (P x N) used for fitting.
- detail
Character string controlling the level of computation:
"full"(default) computes all criteria including silhouette, CPCC and dist.cor;"fast"skips the expensive distance-based criteria;"minimal"returns only information criteria.- ...
Additional arguments:
Y.weights(weight matrix, default: all ones).
Value
A list with components:
- r.squared
R-squared between Y and XB.
- sigma
Residual standard deviation.
- mae
Mean absolute error.
- B.prob
Column-normalized coefficient matrix (soft-clustering probabilities).
- B.cluster
Hard clustering labels (argmax of B.prob per column).
- X.prob
Row-normalized basis matrix.
- X.cluster
Hard clustering labels per row of X.
- criterion
Named list: ICp, ICp1, ICp2, ICp3, AIC, BIC, B.prob.sd.min, B.prob.max.mean, B.prob.entropy.mean, silhouette, CPCC, dist.cor.
Examples
Y <- t(iris[, -5])
res <- nmfkc(Y, rank = 3, detail = "fast")
#> Y(4,150)~X(4,3)B(3,150)...
#> 0sec
crit <- nmfkc.criterion(res, Y)
crit$criterion$silhouette
#> $cluster
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
#> [75] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#> [112] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
#> [149] 3 3
#>
#> $silhouette
#> [1] 0.840685925 0.840484841 0.840233687 0.840061529 0.839222251
#> [6] 0.839219851 0.838304252 0.838087878 0.834910755 0.832421369
#> [11] 0.828906020 0.828482885 0.828056507 0.825722704 0.823836737
#> [16] 0.819467745 0.819424827 0.818829651 0.816071158 0.815525833
#> [21] 0.812193905 0.807089631 0.805810591 0.804999420 0.803848554
#> [26] 0.800399704 0.798920765 0.789626993 0.785180307 0.784462113
#> [31] 0.783272341 0.781538796 0.780331455 0.779468594 0.773180995
#> [36] 0.771210588 0.767236972 0.764822443 0.753985090 0.752284439
#> [41] 0.749874048 0.747789030 0.747023747 0.741251524 0.736403581
#> [46] 0.733227490 0.714635092 0.685227922 0.668538526 0.523223601
#> [51] -0.618488520 -0.647987150 0.589067240 0.588347411 0.584346128
#> [56] 0.581493445 0.569535758 0.562571621 0.560635291 0.559621753
#> [61] 0.551601076 0.550624863 0.541633762 0.532093156 0.521514657
#> [66] 0.519006078 0.518500091 0.517631153 0.510947608 0.507255539
#> [71] 0.506639271 0.498503133 0.473379180 0.470233540 0.466150610
#> [76] 0.460448535 0.447383250 0.443537741 0.430419234 0.430287060
#> [81] 0.393384406 0.370992074 0.363136230 0.341504562 0.338457289
#> [86] 0.289775934 0.268578379 0.253283195 0.253032255 0.241567370
#> [91] 0.225019724 0.201997753 0.197164852 0.146171494 0.087168673
#> [96] 0.078969152 0.633745166 0.632663250 0.620980698 0.618214462
#> [101] 0.615251326 0.610281767 0.608093429 0.604664643 0.603888613
#> [106] 0.603568298 0.603259760 0.598929952 0.597836774 0.594259273
#> [111] 0.582722407 0.582722407 0.581758140 0.580630902 0.575855761
#> [116] 0.571367125 0.567047255 0.562000832 0.554913901 0.549185800
#> [121] 0.539193218 0.525706336 0.517643568 0.517057711 0.510627420
#> [126] 0.497993766 0.493113333 0.467337596 0.465818122 0.451284255
#> [131] 0.445078722 0.432968354 0.429507029 0.396100682 0.353948177
#> [136] 0.353639490 0.347735227 0.333925424 0.221598626 0.209085345
#> [141] 0.191340859 0.189716045 0.150153589 0.142526967 0.141687264
#> [146] 0.111470108 0.092056074 0.008902101 -0.020968079 -0.021622165
#>
#> $silhouette.means
#> [1] 27.67308 88.79545 110.72222
#>
#> $silhouette.mean
#> [1] 0.5358708
#>