recpack.algorithms.util.sample_rows

recpack.algorithms.util.sample_rows(*args: Union[recpack.matrix.interaction_matrix.InteractionMatrix, scipy.sparse._csr.csr_matrix], sample_size: int = 1000) List[Union[recpack.matrix.interaction_matrix.InteractionMatrix, scipy.sparse._csr.csr_matrix]]

Samples rows from the matrices

Rows are sampled from the nonzero rows in the first csr_matrix argument. The return value will contain a matrix for each of the matrix arguments, with only the sampled rows nonzero.

Parameters

sample_size (int, optional) – Number of rows to sample, defaults to 1000

Returns

List of all matrices passed as args

Return type

List[Matrix]