quick_tensortkd

# Import statement

from hottbox.utils.generation import quick_tensortkd
quick_tensortkd(full_shape, rank, base='arange')[source]

Simplified creation of generic tensor in tucker form

Parameters
full_shapetuple

Desired shape of the tensor when it is reconstructed. Values specify the number of rows of the factor matrices.

ranktuple

Desired multi-linear rank of the tensor. Specifies the number of columns for all factor matrices. Should be of the same length as parameter full_shape

basestr

Id of base function that generates values for the components of tucker tensor. If not one from {"arange", "randn", "rand", "ones"} then np.arange will be used.

Returns
tensor_tkdTensorTKD

Examples

>>> from hottbox.utils.generation import quick_tensortkd
>>> tensor_tkd = quick_tensortkd(full_shape=(5, 6, 7), rank=(2, 3, 4), base="ones")
>>> print(tensor_tkd)
    Tucker representation of a tensor with multi-linear rank=(2,).
    Factor matrices represent properties: ['mode-0', 'mode-1', 'mode-2']
    With corresponding latent components described by (5, 6, 7) features respectively.
>>> tensor = tensor_tkd.reconstruct()
>>> print(tensor)
    This tensor is of order 3 and consists of 210 elements.
    Sizes and names of its modes are (5, 6, 7) and ['mode-0', 'mode-1', 'mode-2'] respectively.