Integrated algorithm combining ATLD and ALS for the minimization of the Candecomp/Parafac (CP) loss function.
cp_int2(
X,
n,
m,
p,
ncomp,
initconv = 0.01,
conv = 1e-06,
const = "none",
start = "random",
maxit = 5000,
trace = FALSE
)
The result of the decomposition as a list with the following elements:
fit
Value of the loss function
fp
Fit value expressed as a percentage
ss
Sum of squares
A
Component matrix for the A-mode
B
Component matrix for the B-mode
C
Component matrix for the C-mode
iter
Number of iterations
tripcos
Minimal triple cosine between two components
across the three component matrices, used to inspect degeneracy
mintripcos
Minimal triple cosine during the iterative
algorithm observed at every 10 iterations, used to inspect degeneracy
ftiter
Matrix containing in each row the function value
and the minimal triple cosine at every 10 iterations
const
Optional constraints (same as the input parameter
const
)
A three-way array or a matrix. If X
is a matrix
(matricised threeway array), n
, m
and p
must be
given and are the number of A-, B- and C-mode entities respectively
Number of A-mode entities
Number of B-mode entities
Number of C-mode entities
Number of components to extract
Convergence criterion for the initialization phase (ATLD),
default is conv=1e-2
.
Convergence criterion, default is conv=1e-6
.
Optional constraints for each mode. Can be a three element
character vector or a single character, one of "none"
for no
constraints (default), "orth"
for orthogonality constraints or
"zerocor"
for zero correlation between the extracted factors.
For example, const="orth"
means orthogonality constraints for
all modes, while const=c("orth", "none", "none")
sets the
orthogonality constraint only for mode A.
Initial values for the A, B and C components. Can be
"svd"
for starting point of the algorithm from SVD's,
"random"
for random starting point (orthonormalized
component matrices or nonnegative matrices in case of nonnegativity
constraint), or a list containing user specified components.
Maximum number of iterations, default is maxit=10000
.
Logical, provide trace output.
Valentin Todorov, valentin.todorov@chello.at; Violetta Simonacci, violetta.simonacci@unina.it
H.-L. Wu, M. Shibukawa, K. Oguma, An alternating trilinear decomposition algorithm with application to calibration of HPLC-DAD for simultaneous determination of overlapped chlorinated aromatic hydrocarbons, Journal of Chemometrics 12 (1998) 1--26.
Simonacci, V. and Gallo, M. (2020). An ATLD--ALS method for the trilinear decomposition of large third-order tensors, Soft Computing 24 13535--13546.
Todorov, V. and Simonacci, V. and Gallo, M. and Trendafilov, N. (2023). A novel estimation procedure for robust CANDECOMP/PARAFAC model fitting. Econometrics and Statistics. In press.
if (FALSE) {
## Example with the OECD data
data(elind)
dim(elind)
res <- cp_int2(elind, ncomp=3)
res$fp
res$fp
res$iter
res <- cp_int2(elind, ncomp=3, const="orth")
res$A
}
Run the code above in your browser using DataLab