Skip to contents

S4 Class implementing NNMF.

Details

NNMF is a method for decomposing a matrix into a smaller dimension such that the constraint that the data (and the projection) are not negative is taken into account.

Slots

fun

A function that does the embedding and returns a dimRedResult object.

stdpars

The standard parameters for the function.

General usage

Dimensionality reduction methods are S4 Classes that either be used directly, in which case they have to be initialized and a full list with parameters has to be handed to the @fun() slot, or the method name be passed to the embed function and parameters can be given to the ..., in which case missing parameters will be replaced by the ones in the @stdpars.

Parameters

The method can take the following parameters:

ndim

The number of output dimensions.

method

character, which algorithm should be used. See nmf for possible values. Defaults to "brunet"

nrun

integer, the number of times the computations are conducted. See nmf

seed

integer, a value to control the random numbers used.

options

named list, other options to pass to nmf

Implementation

Wraps around nmf. Note that the estimation uses random numbers. To create reproducible results, set the random number seed in the function call. Also, in many cases, the computations will be conducted in parallel using multiple cores. To disable this, use the option .pbackend = NULL.

References

Lee, D.D., Seung, H.S., 1999. Learning the parts of objects by non-negative matrix factorization. Nature 401, 788-791. https://doi.org/10.1038/44565

Examples

if(requireNamespace(c("NNMF", "MASS"), quietly = TRUE)) {

set.seed(4646)
dat <- loadDataSet("Iris")
emb <- embed(dat, "NNMF")

plot(emb)

# project new values:
nn_proj <- predict(emb, dat[1:7])
plot(nn_proj)

}