python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】)
def argmax(a, axis=None, out=None):"""Returns the indices of the maximum values along an axis.返回沿轴的最大值的索引。Parameters----------a : array_likeInput array.输入数组。axis : int, optionalBy default, the index is into the flattened array, otherwisealong the specified axis.默认情况下,索引位于平面数组中(就是直接把数组摊开,没有轴的概念),否则沿指定的轴。out : array, optionalIf provided, the result will be inserted into this array. It shouldbe of the appropriate shape and dtype.如果提供,结果将被插入此数组。 它应该具有适当的形状和dtype。Returns-------index_array : ndarray of ints 整数数组Array of indices into the array. It has the same shape as `a.shape`with the dimension along `axis` removed.索引数组到数组中。 它的形状与“ a.shape”相同,但沿“轴”的尺寸已删除。See Also--------ndarray.argmax, argminamax : The maximum value along a given axis.unravel_index : Convert a flat index into an index tuple.Notes-----In case of multiple occurrences of the maximum values, the indicescorresponding to the first occurrence are returned.在多次出现最大值的情况下,返回对应于第一次出现的索引。Examples-------->>> a = np.arange(6).reshape(2,3)>>> aarray([[0, 1, 2],[3, 4, 5]])>>> np.argmax(a)5>>> np.argmax(a, axis=0)array([1, 1, 1])>>> np.argmax(a, axis=1)array([2, 2])Indexes of the maximal elements of a N-dimensional array:N维数组的最大元素的索引:>>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape)>>> ind(1, 2)>>> a[ind]5>>> b = np.arange(6)>>> b[1] = 5>>> barray([0, 5, 2, 3, 4, 5])>>> np.argmax(b) # Only the first occurrence is returned. 仅返回第一个匹配项。1"""return _wrapfunc(a, 'argmax', axis=axis, out=out)
python numpy np.argmax(a, axis=None, out=None) (按给定轴位比较,返回第一个最大值索引【下标】)相关推荐
- python numpy np.fromstring()函数(从字符串文本中提取数字,返回一维数组)(爬虫提取数字挺好用的)
from numpy\core\multiarray.py def fromstring(string, dtype=None, count=-1, sep=''): # real signature ...
- python numpy np.argsort()(返回将对数组进行排序的索引)(不懂区别?)
from numpy\core\fromnumeric.py @array_function_dispatch(_argsort_dispatcher) def argsort(a, axis=-1, ...
- python numpy np.lexsort()(使用键序列执行间接稳定排序)(具体没太搞懂区别?)
from numpy\core_multiarray_umath.py @array_function_from_c_func_and_dispatcher(_multiarray_umath.lex ...
- (python numpy) np.array.shape 中 (3,)、(3,1)、(1,3)的区别
(python numpy) np.array.shape 中 (3,).(3,1).(1,3)的区别 被人问到这个问题,就记录一下吧 1. (3,) (3,)是[x,y,z][x,y,z][x,y, ...
- python numpy之argmax()方法理解
1.numpy之argmax()作用 返回相应维度axis上的最大值的位置. 2.具体应用 深度学习图像分割多分类最后是softmax得分结果,我们需要将这个浮点型的结果保存成整型的标签图像,这样才算 ...
- Python中np.sum()对axis的个人理解,超详细
你们讨论的axis=0和1并不是简单的行和列,axis=0表示的是第一个维度,在第一个维度上的元素间进行求和.比较大小,axis=1表示的是第二个维度,在第二个维度上的元素间进行求和.比较大小.一个维 ...
- python numpy np.finfo()函数 eps
用法 finfo函数是根据括号中的类型来获得信息,获得符合这个类型的数型 例1: import numpy as np a=np.array([[1],[2],[-1],[0]]) b=np.maxi ...
- [转载] python numpy np.finfo()函数 eps
参考链接: Python中的numpy.log2 用法 finfo函数是根据括号中的类型来获得信息,获得符合这个类型的数型 例1: import numpy as np a=np.array([[1] ...
- [转载] python numpy np.exp()函数
参考链接: Python中的numpy.exp def exp(x, *args, **kwargs): # real signature unknown; NOTE: unreliably rest ...
最新文章
- Ecshop文章列表页显示内容摘要
- 2个点马氏距离计算实例_数据分析基础:距离度量方式(欧式距离、马氏距离、曼哈顿距离)...
- 超纯超美的曲线(Peter De Jong Attractor)
- [How TO]-堡垒机快捷登陆SSH服务器-expect自动输密码
- mysql select 缓存_mysql select缓存机制使用详解
- C语言各种变量的初始化
- 邮件excel html,小数点分隔符在电子邮件(HTML/CSS)在Excel的VBA编程
- iBATIS.net获取运行时sql语句
- 马尔科夫随机场之图像去燥【Matlab实现,PRML例子】
- codeigniter 操作 图标
- ArcGIS API For Javascript :如何动态生成 token 加载权限分配的地图服务?
- 微软请你学Linux第三季: 6月最后的约会,再次诚意邀请!
- Data truncation: Out of range value for column ‘quanity‘ at row 问题解决方案
- unity 模型销毁_Unity GameObject 销毁(Destroy)后的几种状态
- [Canvas]空战游戏进阶 增加己方子弹管理类
- 在向服务器发送请求时发生传输级错误。
- windows安装补丁慢 360安全卫士和腾讯电脑管家安装同样卡住 解决办法
- java quartz插件_JFinal Quartz 2.2.1插件
- MPQ文档布局分析[转帖]
- Linux环境下右键无法新建文档的解决方法——Ubuntu 16.x