# Import statement
from hottbox.algorithms.decomposition import RandomisedCPD
RandomisedCPD
(init='svd', sample_size=None, max_iter=50, epsilon=0.01, tol=0.0001, random_state=None, verbose=False)[source]¶Randomised Canonical Polyadic Decomposition.
Computed via sampled 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. |
References
Battaglino, C., Ballard, G., & Kolda, T. G. (2018). A Practical Randomized CP Tensor Decomposition. SIAM Journal on Matrix Analysis and Applications, 39(2), 876–901. http://doi.org/10.1137/17m1112303
Methods
|
Copy of the CPD algorithm as a new object |
|
Performs CPD-ALS on the |
plot |
converged
¶Checks convergence of the Randomised CPD-ALS algorithm.
decompose
(self, tensor, rank, keep_meta=0, kr_reverse=False)[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
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