稀疏稀疏矩阵中每一行或每一列的Argmax
问题描述:
scipy.sparse.coo_matrix.max
返回给定轴的每一行或每一列的最大值.我想知道的不是值,而是每行或每一列的最大值的索引.我还没有找到一种有效的方法,所以我很乐意接受任何帮助.
scipy.sparse.coo_matrix.max
returns the maximum value of each row or column, given an axis. I would like to know not the value, but the index of the maximum value of each row or column. I haven't found a way to make this in an efficient manner yet, so I'll gladly accept any help.
答
从scipy版本0.19开始,csr_matrix
和csc_matrix
都支持argmax()
和argmin()
方法.
From scipy version 0.19, both csr_matrix
and csc_matrix
support argmax()
and argmin()
methods.