streamsight.matrix.to_csr_matrix

streamsight.matrix.to_csr_matrix(X: InteractionMatrix | csr_matrix, binary: bool = False) csr_matrix

Convert a matrix-like object to a scipy csr_matrix.

Parameters:
  • X (csr_matrix) – Matrix-like object or tuple of objects to convert.

  • binary (bool, optional) – If true, ensure matrix is binary by setting non-zero values to 1.

Returns:

Matrices as csr_matrix.

Return type:

Union[csr_matrix, Tuple[csr_matrix, …]]