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.

matricesndarray list

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

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

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

skip_matrixNone or int, optional, default is None

if not None, index of a matrix to skip

random_stateNone, 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_rowsbool, default is False

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


The sampled matricised tensor Khatri-Rao with n_samples rows

indicestuple list

a list of indices sampled for each mode

indices_krint list

list of length n_samples containing the sampled row indices