稀疏稀疏矩阵中每一行或每一列的Argmax [英] Argmax of each row or column in scipy sparse matrix

查看:94
本文介绍了稀疏稀疏矩阵中每一行或每一列的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_matrixcsc_matrix都支持argmax()argmin()方法.

From scipy version 0.19, both csr_matrix and csc_matrix support argmax() and argmin() methods.

这篇关于稀疏稀疏矩阵中每一行或每一列的Argmax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆