5

I am attempting to partition a matrix using np.argpartition.

This works fine for numpy matrices but not for scipy compressed csr matrix.

I am attempting to partition it in axis 1 but since a scipy csr matrix becomes a vector I am facing issues. Is there an analogous function to np.argpartition in scipy?

Ralf
  • 16,086
  • 4
  • 44
  • 68
thechargedneutron
  • 802
  • 1
  • 9
  • 24
  • Do you want to consider only nonzeros or everything? – Paul Panzer Nov 24 '17 at 19:40
  • There isn't even a `sort` or `argsort` for sparse matrices. Simply giving a sparse matrix to a numpy function rarely works. It might help if you gave a small example what you do with the dense array. Make sure it's sparse and you are clear about how the mix of zeros and nonzeros are handle. – hpaulj Nov 24 '17 at 21:09
  • @PaulPanzer Everything – thechargedneutron Nov 24 '17 at 22:08
  • https://stackoverflow.com/questions/30742572/argmax-of-each-row-or-column-in-scipy-sparse-matrix - question about rowwise argmax for sparse. I have vague memories of questions about finding the top N values per row, but can't find them. – hpaulj Nov 24 '17 at 22:16
  • _Everything_. That's tricky, what format would you want the result in for starters? – Paul Panzer Nov 24 '17 at 22:58

0 Answers0