nmf.cluster.criteria: Sample-clustering quality across ranks

View source: R/nmfkc.R

nmf.cluster.criteriaR Documentation

Sample-clustering quality across ranks

Description

Computes the clustering-quality criteria silhouette, CPCC, and dist.cor for a list of models fitted at different ranks (or a single fit), returning one row per rank. These are clustering-stability diagnostics (how decisively and faithfully the samples cluster), conceptually separate from the rank-selection *.rank functions (which use r.squared, effective rank, and ECV) and complementary to nmf.cluster.flow (which shows how the hard clustering itself changes across ranks).

Hard sample clustering requires a non-negative coefficient/score matrix (so the columns form a membership simplex); when a model's coefficient is signed (e.g.\ nmfkc.signed, nmfae.signed, nmfre fits whose coefficient has negative entries) the hard-label silhouette is NA while the distance-based CPCC and dist.cor are still computed.

Usage

nmf.cluster.criteria(fits, Y, Y2 = NULL, names = NULL, plot = TRUE, ...)

Arguments

fits

A list of fitted models, one per rank, all over the same N individuals (a single fitted model is also accepted and wrapped automatically). Supported families: nmfkc, nmfkc.signed, nmfae, nmfae.signed, nmfkc.net, nmfre, and nmf.sem / nmf.ffb.

Y

The original data matrix used to fit the models (Y_1 for nmf.ffb); required for the data-space distances.

Y2

Exogenous block, required only for nmf.ffb / nmf.sem.

names

Optional character vector (length length(fits)) of x-axis tick labels. Defaults to each result's $rank.

plot

Logical; draw the diagnostics plot immediately (default TRUE); see plot.nmf.cluster.criteria.

...

When plot = TRUE, graphical arguments forwarded to plot.nmf.cluster.criteria.

Value

An object of class "nmf.cluster.criteria" (returned invisibly): a list with criteria (a data frame with one row per result and columns rank, silhouette, CPCC, dist.cor, and hard) and labels (the x-axis labels). Results are kept in the given order (not sorted).

See Also

nmf.cluster.flow, nmfkc.rank

Examples


Y <- t(as.matrix(iris[, 1:4]))
fits <- lapply(2:6, function(q) nmfkc(Y, Q = q, print.dims = FALSE))
cc <- nmf.cluster.criteria(fits, Y, plot = FALSE)
cc$criteria
plot(cc)


nmfkc documentation built on July 14, 2026, 1:07 a.m.