tensorly.contrib.sparse.decomposition.partial_tucker
- partial_tucker(tensor, modes, rank=None, n_iter_max=100, init='svd', tol=0.0001, svd='numpy_svd', random_state=None, verbose=False, mask=None)
Partial tucker decomposition via Higher Order Orthogonal Iteration (HOI)
Decomposes tensor into a Tucker decomposition exclusively along the provided modes.
- Parameters
- tensorndarray
- modesint list
list of the modes on which to perform the decomposition
- rankNone, int or int list
size of the core tensor,
(len(ranks) == tensor.ndim)
if int, the same rank is used for all modes- n_iter_maxint
maximum number of iteration
- init{‘svd’, ‘random’}, or TuckerTensor optional
if a TuckerTensor is provided, this is used for initialization
- svdstr, default is ‘numpy_svd’
function to use to compute the SVD, acceptable values in tensorly.SVD_FUNS
- tolfloat, optional
tolerance: the algorithm stops when the variation in the reconstruction error is less than the tolerance
- random_state{None, int, np.random.RandomState}
- verboseint, optional
level of verbosity
- maskndarray
array of booleans with the same shape as
tensor
should be 0 where the values are missing and 1 everywhere else. Note: if tensor is sparse, then mask should also be sparse with a fill value of 1 (or True).
- Returns
- corendarray
core tensor of the Tucker decomposition
- factorsndarray list
list of factors of the Tucker decomposition. with
core.shape[i] == (tensor.shape[i], ranks[i]) for i in modes