RandomisedCPD

# Import statement

from hottbox.algorithms.decomposition import RandomisedCPD
class 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)

Parameters
initstr

Type of factor matrix initialisation. Available options are svd and random

max_iterint

Maximum number of iteration

epsilonfloat

Threshold for the relative error of approximation.

tolfloat

Threshold for convergence of factor matrices

random_stateint
verbosebool

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(self)

Copy of the CPD algorithm as a new object

decompose(self, tensor, rank[, keep_meta, …])

Performs CPD-ALS on the tensor with respect to the specified rank

plot

property converged

Checks convergence of the Randomised CPD-ALS algorithm.

Returns
bool
copy(self)[source]

Copy of the CPD algorithm as a new object

decompose(self, tensor, rank, keep_meta=0, kr_reverse=False)[source]

Performs CPD-ALS on the tensor with respect to the specified rank

Parameters
tensorTensor

Multi-dimensional data to be decomposed

ranktuple

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_metaint

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

kr_reversebool
Returns
tensor_cpdTensorCPD

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

property name

Name of the decomposition

Returns
decomposition_namestr