Canonical Polyadic (CP) decomposition of a tensor, aka
CANDECOMP/PARAFAC. Approximate a K-Tensor using a sum of
num_components rank-1 K-Tensors. A rank-1 K-Tensor can be written
as an outer product of K vectors. There are a total of
num_components * tnsr$num_modes vectors in the output, stored in
tnsr$num_modes matrices, each with num_components columns.
This is an iterative algorithm, with two possible stopping conditions:
either relative error in Frobenius norm has gotten below tol, or
the max_iter number of iterations has been reached. For more details
on CP decomposition, consult Kolda and Bader (2009).
cpDecomposition(tnsr, num_components = NULL, max_iter = 25, tol = 1e-05)A list containing the following
lambdasA vector of normalizing constants, one for each component.
UA list of matrices, one for each mode, each with num_components columns.
convWhether or not resid < tol by the last iteration.
norm_percentThe percent of Frobenius norm explained by the approximation.
estEstimate of tnsr after compression.
fnorm_residThe Frobenius norm of the error.
all_residsVector containing the Frobenius norm of error for all iterations.
Tensor with K modes.
The number of rank-1 K-Tensors to use in approximation.
Maximum number of iterations if error stays above tol.
Relative Frobenius norm error tolerance.
Uses the Alternating Least Squares (ALS) estimation procedure. A progress bar is included to help monitor operations on large tensors.
T. Kolda, B. Bader, "Tensor decomposition and applications". SIAM Applied Mathematics and Applications 2009.