Skip to contents

PARAFAC loss function calculation

Usage

parafac_fun(x, Tensor, lambdas = NULL)

Arguments

x

Vector of fitted loadings generated by the PARAFAC algorithm, can also be a Fac object

Tensor

input data

lambdas

If lambdas (from the kruskal tensor case) are generated to make the Fac norm 1, they can be supplied.

Value

Scalar value of the loss function

Examples

A = array(rnorm(108*2), c(108,2))
B = array(rnorm(100*2), c(100,2))
C = array(rnorm(10*2), c(10,2))
X = reinflateTensor(A, B, C)
model = parafac(X, 2)
f = parafac_fun(model$Fac, X)