# Import statement
from hottbox.algorithms.decomposition import CPD
CPD
(init='svd', max_iter=50, epsilon=0.01, tol=0.0001, random_state=None, verbose=False)[source]¶Canonical Polyadic Decomposition.
Computed via alternating least squares (ALS)
Type of factor matrix initialisation. Available options are svd and random
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. |
Methods
|
Copy of the CPD algorithm as a new object |
|
Performs CPD-ALS on the |
plot |
converged
¶Checks convergence of the CPD-ALS algorithm.
decompose
(self, tensor, rank, keep_meta=0, kr_reverse=False, factor_mat=None)[source]¶Performs CPD-ALS on the tensor
with respect to the specified rank
Multi-dimensional data 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
Keep meta information about modes of the given tensor
.
0 - the output will have default values for the meta data
1 - keep only mode names
2 - keep mode names and indices
Initial list of factor matrices.
Specifying this option will ignore init
.
CP representation of the tensor
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