NMFfit-class: Base Class for to store Nonnegative Matrix Factorisation...

Description Usage Arguments Details Slots Methods (by generic) Examples

Description

Base class to handle the results of general Nonnegative Matrix Factorisation algorithms (NMF).

Usage

 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
NMFfit(fit = nmfModel(), ..., rng = NULL)

## S4 method for signature 'NMFfit'
fitted(object, ...)

## S4 method for signature 'NMFfit'
.basis(object, ...)

## S4 replacement method for signature 'NMFfit,matrix'
.basis(object) <- value

## S4 method for signature 'NMFfit'
.coef(object, ...)

## S4 replacement method for signature 'NMFfit,matrix'
.coef(object) <- value

## S4 method for signature 'NMFfit'
ibterms(object)

## S4 method for signature 'NMFfit'
icterms(object)

## S4 method for signature 'NMFfit'
offset(object)

## S4 method for signature 'NMFfit'
niter(object, ...)

## S4 replacement method for signature 'NMFfit,numeric'
niter(object) <- value

## S4 method for signature 'NMFfit'
show(object)

## S4 method for signature 'NMFfit'
fit(object)

## S4 replacement method for signature 'NMFfit,NMF'
fit(object) <- value

## S4 method for signature 'NMFfit'
minfit(object)

## S4 method for signature 'NMFfit'
modelname(object)

## S4 method for signature 'NMFfit'
algorithm(object)

## S4 replacement method for signature 'NMFfit,ANY'
algorithm(object) <- value

## S4 method for signature 'NMFfit'
seeding(object)

## S4 replacement method for signature 'NMFfit'
seeding(object) <- value

## S4 method for signature 'NMFfit'
objective(object, y)

## S4 replacement method for signature 'NMFfit,ANY'
objective(object) <- value

## S4 method for signature 'NMFfit'
runtime(object, ...)

## S4 method for signature 'NMFfit'
runtime.all(object, ...)

## S4 method for signature 'NMFfit,missing'
plot(x, y, skip = -1L, ...)

## S4 method for signature 'NMFfit'
summary(object, ...)

## S4 method for signature 'NMFfit,NMF'
nmf.equal(x, y, ...)

## S4 method for signature 'NMFfit,NMFfit'
nmf.equal(x, y, ...)

## S4 method for signature 'NMFfit'
nrun(object)

## S4 method for signature 'NMFfit'
consensus(object, ...)

## S4 method for signature 'NMFfit'
icterms(object)

Arguments

fit

an NMF model

...

extra arguments passed to base graphics plot function.

rng

RNG settings specification (typically a suitable value for .Random.seed).

object

an object of class NMFfit.

value

an object used to modify the properties of the object. Depending on the method, it may be a matrix, numeric, an NMF model object, etc...

y

optional target matrix used to compute the objective value.

x

an NMF object as returned by nmf.

skip

an integer that indicates the number of points to skip/remove from the beginning of the curve. If skip=1L (default) only the initial residual – that is computed before any iteration, is skipped, if present in the track (it associated with iteration 0).

Details

It provides a general structure and generic functions to manage the results of NMF algorithms. It contains a slot with the fitted NMF model (see slot fit) as well as data about the methods and parameters used to compute the factorization.

The purpose of this class is to handle in a generic way the results of NMF algorithms. Its slot fit contains the fitted NMF model as an object of class NMF.

Other slots contains data about how the factorization has been computed, such as the algorithm and seeding method, the computation time, the final residuals, etc...

Class NMFfit acts as a wrapper class for its slot fit. It inherits from interface class NMF defined for generic NMF models. Therefore, all the methods defined by this interface can be called directly on objects of class NMFfit. The calls are simply dispatched on slot fit, i.e. the results are the same as if calling the methods directly on slot fit.

Slots

fit

An object that inherits from class NMF, and contains the fitted NMF model.

NB: class NMF is a virtual class. The default class for this slot is NMFstd, that implements the standard NMF model.

residuals

A numeric vector that contains the final residuals or the residuals track between the target matrix and its NMF estimate(s). Default value is numeric().

See method residuals for details on accessor methods and main interface nmf for details on how to compute NMF with residuals tracking.

method

a single character string that contains the name of the algorithm used to fit the model. Default value is ''.

seed

a single character string that contains the name of the seeding method used to seed the algorithm that fitted the NMF model. Default value is ''. See nmf for more details.

rng

an object that contains the RNG settings used for the fit. Currently the settings are stored as an integer vector, the value of .Random.seed at the time the object is created. It is initialized by the initialized method. See getRNG for more details.

distance

either a single "character" string that contains the name of the built-in objective function, or a function that measures the residuals between the target matrix and its NMF estimate. See objective and deviance,NMF-method.

parameters

a list that contains the extra parameters – usually specific to the algorithm – that were used to fit the model.

runtime

object of class "proc_time" that contains various measures of the time spent to fit the model. See system.time

options

a list that contains the options used to compute the object.

extra

a list that contains extra miscellaneous data for internal usage only. For example it can be used to store extra parameters or temporary data, without the need to explicitly extend the NMFfit class. Currently built-in algorithms only use this slot to store the number of iterations performed to fit the object.

Data that need to be easily accessible by the end-user should rather be set using the methods $<- that sets elements in the list slot misc – that is inherited from class NMF.

call

stored call to the last nmf method that generated the object.

Methods (by generic)

.basis:

.basis<-:

.coef:

.coef<-:

algorithm:

compare:

consensus:

deviance:

fit:

fit<-:

fitted:

ibterms:

icterms:

minfit:

modelname:

niter:

niter<-:

nmf.equal:

NMFfitX:

nrun:

objective:

offset:

plot:

residuals:

run:

runtime:

runtime.all:

seeding:

show:

summary:

Examples

 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
# run default NMF algorithm on a random matrix
n <- 50; r <- 3; p <- 20
V <- rmatrix(n, p)  
res <- nmf(V, r)							

# result class is NMFfit
class(res)
isNMFfit(res)

# show result
res

# compute summary measures
summary(res, target=V)

# generate a synthetic dataset with known classes: 50 features, 18 samples (5+5+8)
n <- 50; counts <- c(5, 5, 8);
V <- syntheticNMF(n, counts)
cl <- unlist(mapply(rep, 1:3, counts))

# perform default NMF with rank=2
x2 <- nmf(V, 2)
summary(x2, cl, V)
# perform default NMF with rank=2
x3 <- nmf(V, 3)
summary(x2, cl, V)

renozao/NMF documentation built on June 14, 2020, 9:35 p.m.