is there an easy way to shuffle a sparse matrix in python?
This is how I shuffle a non-sparse matrix:
index = np.arange(np.shape(matrix)[0])
Ok, found it. The sparse format looks a bit confusing in the print-out.
index = np.arange(np.shape(matrix)[0]) print index np.random.shuffle(index) return matrix[index, :]