mse: Mean Squared Error (MSE) of a factorization

Description Usage Arguments Value Examples

View source: R/mse.R View source: R/RcppExports.R

Description

Mean squared error of factor models "W" and "H" given "A"

Usage

1
mse(A, W, H, detail = TRUE)

Arguments

A

dgCMatrix of samples (columns) by features (rows)

W

matrix of class "matrix" with factors (columns) by features (rows)

H

matrix of class "matrix" with samples (columns) by factors (rows)

detail

Whether to calculate residual and imputed error for both entire and zero-masked inputs

Value

If detail = FALSE, returns only mean squared error. If detail = TRUE, returns a list of:

Examples

1
2
3
4
5
6
7
8
## Not run: 
data(moca7k)
model <- lsmf(moca7k, 5, rel.tol = 1e-2)
err.summary <- mse(moca7k, model$W, model$H)
err.summary$mse == model$mse
# [1] TRUE

## End(Not run)

zdebruine/LSMF documentation built on Jan. 1, 2021, 1:50 p.m.