Learn R Programming

NMF (version 0.20.6)

fitted: 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, ...)

## S3 method for class 'NMFstd': fitted(object, W, H, ...)

## S3 method for class 'NMFOffset': fitted(object, W, H, offset = object@offset)

## S3 method for class 'NMFns': fitted(object, W, H, S, ...)

Arguments

object
an object that inherit from class NMF
...
extra arguments to allow extension
W
a matrix to use in the computation as the basis matrix in place of basis(object). It must be compatible with the coefficient matrix used in the computation (i.e. number of columns in W = number of rows in H).
H
a matrix to use in the computation as the coefficient matrix in place of coef(object). It must be compatible with the basis matrix used in the computation (i.e. number of rows in H = number of columns in W).
offset
offset vector
S
smoothing matrix to use instead of smoothing(object) It must be a square matrix compatible with the basis and coefficient matrices used in the computation.

Value

  • the target matrix estimate as fitted by the model object

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.

Examples

Run this code
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)

# random standard NMF model
x <- rnmf(3, 10, 5)
all.equal(fitted(x), basis(x) %*% coef(x))

Run the code above in your browser using DataLab