Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-31 Thread Ralf Gommers
On Sun, May 30, 2021 at 10:41 AM wrote: > > > > > > On Fri, May 28, 2021 at 4:58 PM > > wrote: > > > > Hi all, > > > > Finding topk elements is widely used in several fields, but missed > > in NumPy. > > I implement this functionality named as

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-31 Thread Ralf Gommers
On Sun, May 30, 2021 at 10:01 AM Matti Picus wrote: > > > Did this function come up at all in the array-API consortium dicussions? > It happens to be in this list of functions which was made last week: https://github.com/data-apis/array-api/issues/187. That list is potential next candidates,

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-31 Thread Jonathan Fine
Here's my opinion, as a bit of an outsider. Mainly, I understand MAX to mean the largest value in a finite totally ordered set. I understand TOP to mean the 'best' member of a finite set. For example, on a mountain each point has a HEIGHT. There will be a MAX HEIGHT. The point(s) on the mountain

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Benjamin Root
to be honest, I read "topk" as "topeka", but I am weird. While numpy doesn't use underscores all that much, I think this is one case where it makes sense. I'd also watch out for the use of the term "sorted", as it may mean different things to different people, particularly with regards to what

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread kangkai
> > > On Fri, May 28, 2021 at 4:58 PM > wrote: > > Hi all, > > Finding topk elements is widely used in several fields, but missed > in NumPy. > I implement this functionality named as numpy.topk using core numpy > functions and open a PR: >

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Neal Becker
Topk is a bad choice imo. I initially parsed it as to_pk, and had no idea what that was, although sounded a lot like a scipy signal function. Nlargest would be very obvious. On Sun, May 30, 2021, 7:50 AM Alan G. Isaac wrote: > Mathematica and Julia both seem relevant here. > Mma has

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Alan G. Isaac
Mathematica and Julia both seem relevant here. Mma has TakeLargest (and Wolfram tends to think hard about names). https://reference.wolfram.com/language/ref/TakeLargest.html Julia's closest comparable is perhaps partialsortperm:

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Alan G. Isaac
Is there any thought of allowing for other comparisons? In which case `last_k` might be preferable. Alan Isaac On 5/30/2021 2:38 AM, Ilhan Polat wrote: I think "max_k" is a good generalization of the regular "max". ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Daniele Nicolodi
On 30/05/2021 00:48, Robert Kern wrote: > On Sat, May 29, 2021 at 3:35 PM Daniele Nicolodi > wrote: > > What does k stand for here? As someone that never encountered this > function before I find both names equally confusing. If I understand > what the

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Matti Picus
On 29/5/21 5:28 pm, Ralf Gommers wrote: On Fri, May 28, 2021 at 4:58 PM > wrote: Hi all, Finding topk elements is widely used in several fields, but missed in NumPy. I implement this functionality named as  numpy.topk using core numpy

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Ilhan Polat
after a coffee, I don't see the point of calling it still "k" so "max_n" is my vote for what its worth. On Sun, May 30, 2021 at 8:38 AM Ilhan Polat wrote: > Since this going into the top namespace, I'd also vote against the > matlab-y "topk" name. And even matlab didn't do what I would expect

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-30 Thread Ilhan Polat
Since this going into the top namespace, I'd also vote against the matlab-y "topk" name. And even matlab didn't do what I would expect and went with maxk https://nl.mathworks.com/help/matlab/ref/maxk.html I think "max_k" is a good generalization of the regular "max". Even when auto-completing,

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-29 Thread Robert Kern
On Sat, May 29, 2021 at 3:35 PM Daniele Nicolodi wrote: > What does k stand for here? As someone that never encountered this > function before I find both names equally confusing. If I understand > what the function is supposed to be doing, I think largest() would be > much more descriptive. >

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-29 Thread Daniele Nicolodi
On 29/05/2021 18:33, David Menéndez Hurtado wrote: > > > On Sat, 29 May 2021, 4:29 pm Ralf Gommers, > wrote: > > > > On Fri, May 28, 2021 at 4:58 PM > wrote: > > Hi all, > > Finding topk elements is

Re: [Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-29 Thread Ralf Gommers
On Fri, May 28, 2021 at 4:58 PM wrote: > Hi all, > > Finding topk elements is widely used in several fields, but missed in > NumPy. > I implement this functionality named as numpy.topk using core numpy > functions and open a PR: > > https://github.com/numpy/numpy/pull/19117 > > Any discussion

[Numpy-discussion] EHN: Discusions about 'add numpy.topk'

2021-05-28 Thread kangkai
Hi all, Finding topk elements is widely used in several fields, but missed in NumPy. I implement this functionality named as numpy.topk using core numpy functions and open a PR: https://github.com/numpy/numpy/pull/19117 Any discussion are welcome. Best wishes, Kang