nmfEstimateRank
helps in choosing an optimal rank by implementing
simple approaches proposed in the litterature.nmfEstimateRank(x, range, method = nmf.getOption("default.algorithm"), nrun = 30, verbose=FALSE, stop=FALSE, ...)
## S3 method for class 'NMF.rank':
plot(x, what = c('all', 'cophenetic', 'rss', 'residuals'
, 'dispersion', 'evar', 'sparseness'
, 'sparseness.basis', 'sparseness.coef')
, ref=NULL, na.rm=FALSE, ...)
nmf
.FALSE
).
This is useful when plotting results which include NAs due to error during the estimation
prnumeric
giving the number of run to perform for each value in range
.numeric
vector containing the ranks of factorization to try.NMF.rank
, as returned by
function nmfEstimateRank
.
The measures contained in ref
are used and plotted as a reference.
The associated curves are drawn in red, while those fromrank
. To print verbose (resp. debug) messages from each NMF run, one can use
.options='v'
(resp. .options='d'
) thaTRUE
, the whole execution will stop if any error is raised.
When FALSE
(default), the runs that raise an error will be skipped,
and the execution wilcharacter
string that partially matches one of the
following item: 'all'
, 'cophenetic'
, 'rss'
, 'residuals'
, 'dispersion'
.
It specifies which measure must be plotted (nmfEstimateRank
a target object to be estimated, in one of the format accepted
by interface nmf
.
For plot.NMF.rank
an object of class NMF.rank
as returned by nmfEstimateRank
, these are extra parameters passed to interface
nmf
. Note that the same parameters are used for each value of the rank.
See nmf
.
For plot.NMF.ran
NMF.rank
with the following slots:data.frame
containing the quality measures for each
rank of factorizations in range
. Each row correspond to a measure,
each column to a rank.list
of consensus matrices, indexed by the rank of
factorization (as a character string).The function nmfEstimateRank
allow to launch this estimation procedure.
It performs multiple NMF runs for a range of rank of factorization and, for each,
returns a set of quality measures together with the associated consensus matrice.
set.seed(123456)
n <- 50; r <- 3; m <- 20
V <- syntheticNMF(n, r, m, noise=TRUE)
# Use a seed that will be set before each first run
res.estimate <- nmfEstimateRank(V, seq(2,5), method='brunet', nrun=10, seed=123456)
# plot all the measures
plot(res.estimate)
# or only one: e.g. the cophenetic correlation coefficient
plot(res.estimate, 'cophenetic')
Run the code above in your browser using DataLab