sample_khatri_rao(matrices, n_samples, skip_matrix=None, return_sampled_rows=False, random_state=None)[source]

Random subsample of the Khatri-Rao product of the given list of matrices

If one matrix only is given, that matrix is directly returned.


matrices : ndarray list

list of matrices with the same number of columns, i.e.:

for i in len(matrices):
    matrices[i].shape = (n_i, m)

n_samples : int

number of samples to be taken from the Khatri-Rao product

skip_matrix : None or int, optional, default is None

if not None, index of a matrix to skip

random_state : None, int or numpy.random.RandomState

if int, used to set the seed of the random number generator if numpy.random.RandomState, used to generate random_samples

returned_sampled_rows : bool, default is False

if True, also returns a list of the rows sampled from the full khatri-rao product


sampled_Khatri_Rao : ndarray

The sampled matricised tensor Khatri-Rao with n_samples rows

indices : tuple list

a list of indices sampled for each mode

indices_kr : int list

list of length n_samples containing the sampled row indices