Description Usage Arguments Details Value Author(s) Examples
MSE of factor models w
and h
given sparse matrix A
1 |
A |
matrix of features-by-samples in dense or sparse format (preferred classes are "matrix" or "Matrix::dgCMatrix", respectively). Prefer sparse storage when more than half of all values are zero. |
w |
dense matrix of class |
d |
diagonal scaling vector of rank length |
h |
dense matrix of class |
mask_zeros |
handle zeros as missing values, available only when |
Mean squared error of a matrix factorization of the form A = wdh is given by
\frac{∑_{i,j}{(A - wdh)^2}}{ij}
where i and j are the number of rows and columns in A.
Thus, this function simply calculates the cross-product of wh or wdh (if d is specified), subtracts that from A, squares the result, and calculates the mean of all values.
If no diagonal scaling vector is present in the model, input d = rep(1, k)
where k
is the rank of the model.
Parallelization. Calculation of mean squared error is performed in parallel across columns in A
using the number of threads set by setRcppMLthreads
.
By default, all available threads are used, see getRcppMLthreads
.
mean squared error of the factorization model
Zach DeBruine
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.