mardi 1 décembre 2020

How to efficiently shuffle a scipy sparse matrix, whatever its format?

How can I shuffle the rows of a scipy sparse matrix?

There is a scikitlearn.utils.shuffle, but it returns a new matrix, and so for a very large sparse matrix, the shuffling is not done in-place but instead the matrix is replicated.

There is numpy.random.Generator.shuffle, but it seems to work only for CSR matrices.

How to efficiently shuffle the rows of a scipy sparse matrix, whatever the format used to store it in memory?




Aucun commentaire:

Enregistrer un commentaire