partial_tucker#
- ivy.partial_tucker(x, rank=None, modes=None, /, *, n_iter_max=100, init='svd', svd='truncated_svd', seed=None, mask=None, svd_mask_repeats=5, tol=0.0001, verbose=False, return_errors=False)[source]#
Partial tucker decomposition via Higher Order Orthogonal Iteration (HOI)
Decomposes tensor into a Tucker decomposition exclusively along the provided modes.
- Parameters:
x (
Union[Array,NativeArray]) – the input tensorrank (
Optional[Sequence[int]], default:None) – size of the core tensor,(len(ranks) == tensor.ndim)if int, the same rank is used for all modes if None, original tensors size will be preserved.modes (
Optional[Sequence[int]], default:None) – list of the modes on which to perform the decompositionn_iter_max (
Optional[int], default:100) – maximum number of iterationinit (
Optional[Union[Literal['svd','random'],TuckerTensor]], default:'svd') – {‘svd’, ‘random’}, or TuckerTensor optional if a TuckerTensor is provided, this is used for initializationsvd (
Optional[Literal['truncated_svd']], default:'truncated_svd') – str, default is ‘truncated_svd’ function to use to compute the SVD,seed (
Optional[int], default:None) – Used to create a random seed distribution when init == ‘random’mask (
Optional[Union[Array,NativeArray]], default:None) – array of booleans with the same shape astensorshould 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).svd_mask_repeats (
Optional[int], default:5) – number of iterations for imputing the values in the SVD matrix when mask is not Nonetol (
Optional[float], default:0.0001) – tolerance: the algorithm stops when the variation in the reconstruction error is less than the tolerance.verbose (
Optional[bool], default:False) – if True, different in reconstruction errors are returned at each iteration.return_erros – if True, list of reconstruction errors are returned.
- Return type:
- Returns:
core (ndarray) – core tensor of the Tucker decomposition
factors (ndarray list) – list of factors of the Tucker decomposition. with
core.shape[i] == (tensor.shape[i], ranks[i]) for i in modes
- Array.partial_tucker(self, rank=None, modes=None, /, *, n_iter_max=100, init='svd', svd='truncated_svd', seed=None, mask=None, svd_mask_repeats=5, tol=0.0001, verbose=False, return_errors=False)[source]#
ivy.Array instance method variant of ivy.partial_tucker. This method simply wraps the function, and so the docstring for ivy.partial_tucker also applies to this method with minimal changes.
- Parameters:
self (
Union[Array,NativeArray]) – the input tensorrank (
Optional[Sequence[int]], default:None) – size of the core tensor,(len(ranks) == tensor.ndim)if int, the same rank is used for all modes if None, original tensors size will be preserved.modes (
Optional[Sequence[int]], default:None) – list of the modes on which to perform the decompositionn_iter_max (
Optional[int], default:100) – maximum number of iterationinit (
Optional[Union[Literal['svd','random'],TuckerTensor]], default:'svd') – {‘svd’, ‘random’}, or TuckerTensor optional if a TuckerTensor is provided, this is used for initializationsvd (
Optional[Literal['truncated_svd']], default:'truncated_svd') – str, default is ‘truncated_svd’ function to use to compute the SVD,seed (
Optional[int], default:None) – Used to create a random seed distribution when init == ‘random’mask (
Optional[Union[Array,NativeArray]], default:None) – array of booleans with the same shape astensorshould 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).svd_mask_repeats (
Optional[int], default:5) – number of iterations for imputing the values in the SVD matrix when mask is not Nonetol (
Optional[float], default:0.0001) – tolerance: the algorithm stops when the variation in the reconstruction error is less than the tolerance.verbose (
Optional[bool], default:False) – if True, different in reconstruction errors are returned at each iteration.return_erros – if True, list of reconstruction errors are returned.
- Return type:
Tuple[Array,Sequence[Array]]- Returns:
core (ndarray) – core tensor of the Tucker decomposition
factors (ndarray list) – list of factors of the Tucker decomposition. with
core.shape[i] == (tensor.shape[i], ranks[i]) for i in modes
- Container.partial_tucker(self, rank, modes, /, *, n_iter_max=100, init='svd', svd='truncated_svd', seed=None, mask=None, svd_mask_repeats=5, tol=0.0001, verbose=False, return_errors=False, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False)[source]#
ivy.Container static method variant of ivy.partial_tucker. This method simply wraps the function, and so the docstring for ivy.partial_tucker also applies to this method with minimal changes.
- Parameters:
self (
Union[Array,NativeArray,Container]) – input tensorrank (
Union[Sequence[int],Container]) – number of componentsmodes (
Union[Sequence[int],Container]) – modes to consider in the input tensorseed (
Optional[Union[int,Container]], default:None) – Used to create a random seed distribution when init == ‘random’init (
Optional[Union[Literal['svd','random'],TuckerTensor,Container]], default:'svd') – initialization scheme for tucker decomposition.svd (
Optional[Union[Literal['truncated_svd'],Container]], default:'truncated_svd') – function to use to compute the SVDmask (
Optional[Union[Array,NativeArray,Container]], default:None) – array of booleans with the same shape astensorshould 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).svd_mask_repeats (
Optional[Union[int,Container]], default:5) – number of iterations for imputing the values in the SVD matrix when mask is not None
- Return type:
Tuple[Container,Sequence[Container]]- Returns:
core – initialized core tensor
factors – list of factors