# Import statement
from hottbox.algorithms.decomposition import Parafac2
Parafac2
(max_iter=50, epsilon=0.01, tol=0.0001, random_state=None, verbose=False)[source]¶Computes PARAFAC2 for tensors
of order three with respect to a specified rank
.
Computed via alternating least squares (ALS)
Maximum number of iteration
Threshold for the relative error of approximation.
Threshold for convergence of factor matrices
If True, enable verbose output
Attributes
cost |
(list) A list of relative approximation errors at each iteration of the algorithm. |
References
Kiers, H., ten Berge, J. and Bro, R. (1999). PARAFAC2 - Part I. A direct fitting algorithm for the PARAFAC2 model. Journal of Chemometrics, 13(3-4), pp.275-294.
Methods
|
Copy of the CPD algorithm as a new object |
|
Performs Direct fitting using ALS on a list of tensors of order 2 with respect to the specified |
plot |
converged
¶Checks convergence of the CPD-ALS algorithm.
decompose
(self, tenl, rank)[source]¶Performs Direct fitting using ALS on a list of tensors of order 2 with respect to the specified rank
.
List of np.ndarray of dimension 2 to be decomposed
Desired Kruskal rank for the given tensor
. Should contain only one value.
If it is greater then any of dimensions then random initialisation is used
fmat_u,fmat_s,fmat_v are PARAFAC2 representation of list of tensors reconstructed is the reconstruction of the original tensor directly using fmat_u, fmat_s, fmat_v
Notes
khatri-rao product should be of matrices in reversed order. But this will duplicate original data (e.g. images) Probably this has something to do with data ordering in Python and how it relates to kr product
name
¶Name of the decomposition