Description Usage Arguments Details Value References Examples
A critical parameter in NMF algorithms is the factorization rank r.
It defines the number of basis effects used to approximate the target
matrix.
Function nmfEstimateRank
helps in choosing an optimal rank by
implementing simple approaches proposed in the literature.
In the plot generated by plot.NMF.rank
, each curve represents a
summary measure over the range of ranks in the survey.
The colours correspond to the type of data to which the measure is related:
coefficient matrix, basis component matrix, best fit, or consensus matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | nmfEstimateRank(
x,
range,
method = nmf.getOption("default.algorithm"),
nrun = 30,
model = NULL,
...,
verbose = FALSE,
stop = FALSE,
with.silhouette = "both"
)
## S3 method for class 'NMF.rank'
plot(
x,
y = NULL,
what = c("all", "cophenetic", "rss", "residuals", "dispersion", "evar", "sparseness",
"sparseness.basis", "sparseness.coef", "silhouette", "silhouette.coef",
"silhouette.basis", "silhouette.consensus"),
na.rm = FALSE,
xname = "x",
yname = "y",
xlab = "Factorization rank",
ylab = "",
main = "NMF rank survey",
...
)
|
x |
For For |
range |
a |
method |
A single NMF algorithm, in one of the format accepted by
the function |
nrun |
a |
model |
model specification passed to each |
... |
For For |
verbose |
toggle verbosity. This parameter only affects the verbosity
of the outer loop over the values in |
stop |
logical flag for running the estimation process with fault
tolerance. When |
with.silhouette |
indicates which silhouette average width should
be computed. It is passed to the |
y |
reference object of class |
what |
a |
na.rm |
single logical that specifies if the rank for which the
measures are NA values should be removed from the graph or not (default to
|
xname, yname |
legend labels for the curves corresponding to measures from
|
xlab |
x-axis label |
ylab |
y-axis label |
main |
main title |
Note that from version 0.7, one can equivalently call the
function nmf
with a range of ranks.
Given a NMF algorithm and the target matrix, a common way of estimating r is to try different values, compute some quality measures of the results, and choose the best value according to this quality criteria. See Brunet et al. (2004) and Hutchins et al. (2008).
The function nmfEstimateRank
allows to perform 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 matrix.
In order to avoid overfitting, it is recommended to run the same procedure on
randomized data.
The results on the original and the randomised data may be plotted on the
same plots, using argument y
.
nmfEstimateRank
returns a S3 object (i.e. a list) of class
NMF.rank
with the following elements:
measures |
a |
consensus |
a
|
fit |
a |
Brunet J, Tamayo P, Golub TR, Mesirov JP (2004). “Metagenes and molecular pattern discovery using matrix factorization.” _Proceedings of the National Academy of Sciences of the United States of America_, *101*(12), 4164-9. ISSN 0027-8424, doi: 10.1073/pnas.0308531101 (URL: https://doi.org/10.1073/pnas.0308531101).
Hutchins LN, Murphy SM, Singh P, Graber JH (2008). “Position-dependent motif characterization using non-negative matrix factorization.” _Bioinformatics (Oxford, England)_, *24*(23), 2684-90. ISSN 1367-4811, doi: 10.1093/bioinformatics/btn526 (URL: https://doi.org/10.1093/bioinformatics/btn526).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | if( !isCHECK() ){
set.seed(123456)
n <- 50; r <- 3; m <- 20
V <- syntheticNMF(n, r, m)
# Use a seed that will be set before each first run
res <- nmfEstimateRank(V, seq(2,5), method='brunet', nrun=10, seed=123456)
# or equivalently
res <- nmf(V, seq(2,5), method='brunet', nrun=10, seed=123456)
# plot all the measures
plot(res)
# or only one: e.g. the cophenetic correlation coefficient
plot(res, 'cophenetic')
# run same estimation on randomized data
rV <- randomize(V)
rand <- nmfEstimateRank(rV, seq(2,5), method='brunet', nrun=10, seed=123456)
plot(res, rand)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.