nmfkc.net.consensus: Consensus-clustering rank selection for nmfkc.net (Brunet...

View source: R/nmfkc.consensus.R

nmfkc.net.consensusR Documentation

Consensus-clustering rank selection for nmfkc.net (Brunet 2004)

Description

The consensus-clustering stability of nmfkc.consensus, for the network models of nmfkc.net (Y \approx X C X^\top, X X^\top or X (C_+ - C_-) X^\top). The clustered objects are the N nodes.

For each rank, nmfkc.net is run nrun times with different seeds, from a k-means++ start by default (see below). Each run gives a hard clustering of the nodes, the X.cluster of the fit (the largest entry of each row of X). The N \times N connectivity matrices (1 if two nodes share a cluster) are averaged over the runs into the consensus matrix, which is summarized by cophenetic, dispersion and pac exactly as in nmfkc.consensus.

The clustering is taken from X, not from the column maxima of fit$B = C X^\top that nmfkc.consensus uses: with off-diagonal entries in C (or negative ones, for type = "signed"), the columns of C X^\top mix the bases.

Starting values. The consensus needs starts that differ from run to run: at too small a rank, which blocks are merged then changes from run to run, and the rank shows as unstable. The default is X.init = "kmeans++" (D^2 seeding, then Lloyd's iterations), which differs with the seed. Two other starts fail in opposite ways.

  • The default of nmfkc.net, "kmeans", keeps the best of 10 k-means restarts. The runs then nearly always merge the same blocks, and a too small rank looks as stable as the true one.

  • The uniform start of nmfkc.consensus, "runif", stops in poor local minima for "tri" and "signed", so the consensus measures the optimizer rather than the data.

On 20 networks of three planted blocks (10 nodes each, links with probability 0.8 inside a block and 0.05 between blocks), rank 3 had the largest dispersion among ranks 2 to 6, with no tie, in 19 or 20 networks for each type with "kmeans++". With "kmeans" it did in 3; in most of the others ranks 2 and 3 were both fully stable. With "runif" it did in 16 for "bi" and in none for "tri" and "signed". With "nndsvd" (NNDSVDar, whose only randomness is the small fill of its zeros) it did in 11 for "tri", 12 for "signed" and none for "bi". With weaker blocks (0.4 and 0.15) or blocks of unequal size, no start picked rank 3 reliably. Stability favours small ranks, so read it together with nmfkc.net.rank. Other starts can be given through X.init.

Usage

nmfkc.net.consensus(
  Y,
  rank = 2:4,
  type = c("tri", "bi", "signed"),
  nrun = 30,
  keep.consensus = FALSE,
  ...
)

Arguments

Y

Symmetric (N \times N) non-negative adjacency matrix, as for nmfkc.net.

rank

Integer vector of ranks to evaluate.

type

"tri" (default), "bi" or "signed".

nrun

Number of runs (seeds) per rank (default 30).

keep.consensus

Logical; if TRUE also return the list of consensus matrices (one N \times N matrix per rank, named by the nodes).

...

Advanced options, as for nmfkc.consensus: seed (123; run r of rank index i uses seed + 1000 * i + r), pac.range (c(0.1, 0.9)) and cores (getOption("mc.cores", 1L); results are identical for any cores). Any other arguments are passed to nmfkc.net (e.g.\ maxit, epsilon, diag.exclude, Y.weights, X.init, nstart).

Value

An object of class "nmfkc.consensus" with the components of nmfkc.consensus and type; its print.nmfkc.consensus and plot.nmfkc.consensus methods apply.

References

Brunet, J.-P., Tamayo, P., Golub, T. R., Mesirov, J. P. (2004). Metagenes and molecular pattern discovery using matrix factorization. PNAS 101(12):4164–4169. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1073/pnas.0308531101")}.

See Also

nmfkc.net, nmfkc.net.rank, nmfkc.net.ecv, nmfkc.consensus

Examples


## three planted blocks of 10 nodes, linked with probability 0.8 inside a
## block and 0.05 between blocks
set.seed(1)
g <- rep(1:3, each = 10)
P <- ifelse(outer(g, g, "=="), 0.8, 0.05)
Y <- matrix(rbinom(length(P), 1, P), nrow(P))
Y[lower.tri(Y)] <- t(Y)[lower.tri(Y)]; diag(Y) <- 0
cs <- nmfkc.net.consensus(Y, rank = 2:6, nrun = 20, keep.consensus = TRUE)
cs                                    # the most stable rank is 3
plot(cs)
plot(cs, type = "heatmap", rank = 3)


nmfkc documentation built on Nov. 30, 2026, 1:06 a.m.