[Numpy-discussion] argmax for top N elements

Olivier Grisel olivier.grisel at ensta.org
Wed Jun 22 15:10:34 EDT 2011


2011/6/22 RadimRehurek <RadimRehurek at seznam.cz>:
>> Date: Wed, 22 Jun 2011 11:30:47 -0400
>> From: Alex Flint <alex.flint at gmail.com>
>> Subject: [Numpy-discussion] argmax for top N elements
>>
>> Is it possible to use argmax or something similar to find the locations of
>> the largest N elements in a matrix?
>
> I would also be interested in an O(N) argmax/argmin for indices of top k values in an array. I'm currently using argsort[:k] in a performance sensitive part and it's not ideal.

+1

-- 
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel



More information about the NumPy-Discussion mailing list