cp_als: Compute a CP decomposition using an alternating least-squares...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/cp_als.R

Description

computes an estimate of the best rank-R PARAFAC model of a tensor X using an alternating least-squares algorithm Translated from cp_als.m : MATLAB Tensor Toolbox

Usage

1
cp_als(X, R, opts = list())

Arguments

X

is a sparse tensor (a LIST containing subs, vals and size)

R

The rank of the factorization

opts

a list containing the options for the algorithm like maxiters:maximum iterations, tol:tolerance .. etc.

Value

P

the factorization of X as a LIST representing Kruskal Tensor (lambda and u)

Uinit

the initial solution

iters

number of iterations.

fit

fraction explained by the model.

Author(s)

Abdelmoneim Amer Desouki

References

-Brett W. Bader, Tamara G. Kolda and others. MATLAB Tensor Toolbox, Version [v3.0]. Available online at https://www.tensortoolbox.org, 2015.

See Also

cp_apr serial_parCube rescal cp_nmu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
subs=matrix(c(5,1,1,
              3,1,2,
              1,1,3,
              2,1,3,
              4,1,3,
              6,1,3,
              1,1,4,
              2,1,4,
              4,1,4,
              6,1,4,
              1,2,1,
              3,2,1,
              5,2,1),byrow=TRUE,ncol=3)

X=list(subs=subs,vals=rep(1,nrow(subs)),size=c(6,2,4))
set.seed(123)
P1=cp_als(X,2)

RDFTensor documentation built on Jan. 16, 2021, 5:19 p.m.