fitted {NMF} | R Documentation |
Fitted Matrix in NMF Models
Description
Computes the estimated target matrix based on a given
NMF model. The estimation depends on the
underlying NMF model. For example in the standard model
V \equiv W H
, the target matrix is
estimated by the matrix product W H
. In other
models, the estimate may depend on extra
parameters/matrix (cf. Non-smooth NMF in
NMFns-class
).
Usage
fitted(object, ...)
## S4 method for signature 'NMFstd'
fitted(object, W, H, ...)
## S4 method for signature 'NMFOffset'
fitted(object, W, H,
offset = object@offset)
## S4 method for signature 'NMFns'
fitted(object, W, H, S, ...)
Arguments
object |
an object that inherit from class
|
... |
extra arguments to allow extension |
W |
a matrix to use in the computation as the basis
matrix in place of |
H |
a matrix to use in the computation as the
coefficient matrix in place of |
offset |
offset vector |
S |
smoothing matrix to use instead of
|
Details
This function is a S4 generic function imported from
fitted in the package stats. It is
implemented as a pure virtual method for objects of class
NMF
, meaning that concrete NMF models must provide
a definition for their corresponding class (i.e.
sub-classes of class NMF
). See
NMF
for more details.
Value
the target matrix estimate as fitted by the model
object
Methods
- fitted
signature(object = "NMF")
: Pure virtual method for objects of classNMF
, that should be overloaded by sub-classes, and throws an error if called.- fitted
signature(object = "NMFstd")
: Compute the target matrix estimate in standard NMF models.The estimate matrix is computed as the product of the two matrix slots
W
andH
:\hat{V} = W H
- fitted
signature(object = "NMFOffset")
: Computes the target matrix estimate for an NMFOffset object.The estimate is computed as:
W H + offset
- fitted
signature(object = "NMFns")
: Compute estimate for an NMFns object, according to the Nonsmooth NMF model (cf.NMFns-class
).Extra arguments in
...
are passed to methodsmoothing
, and are typically used to pass a value fortheta
, which is used to compute the smoothing matrix instead of the one stored inobject
.- fitted
signature(object = "NMFfit")
: Computes and return the estimated target matrix from an NMF model fitted with functionnmf
.It is a shortcut for
fitted(fit(object), ...)
, dispatching the call to thefitted
method of the actual NMF model.
Examples
# random standard NMF model
x <- rnmf(3, 10, 5)
all.equal(fitted(x), basis(x) %*% coef(x))