[Numpy-discussion] ENH: Proposal to add np.neighborwise in PR#9514
jni.soma at gmail.com
Sun Aug 6 08:37:43 EDT 2017
It’s nice that this is pure Python / NumPy vectorized, whereas generic_filter requires some compilation to get good performance. (Tim, although your implementation is nice and readable, it would have been very slow for any significant volumes.)
However, my feeling is that this function is too specialized for a foundational package like NumPy. As Sebastian Berg pointed out on one of the PRs, it can cause confusion when there are many ways of achieving the same outcome. imho, the One Way to do this kind of operation is using generic_filter together with LowLevelCallable. My two blog posts on the topic:
This has the advantage that it’s even more general. (In fact, it avoids the repeated-applications-vs-diagonal-application argument altogether. These are simply two different kernels.)
Perhaps ndimage lacks discoverability to other fields… But I think that can be better solved with documentation, rather than duplicating functionality and cluttering the NumPy API.
On 6 Aug 2017, 6:02 AM +0200, Tim Cera <tim at cerazone.net>, wrote:
> It you're into reading ancient history here is the link to the discussion where Zachary Pincus makes the same observation and my response was to close the PR because I could use scipy.ndimage.generic_filter, even though at least through my eyes, my implementation was nicer.
> > On Sat, Aug 5, 2017 at 7:56 PM Stefan van der Walt <stefanv at berkeley.edu> wrote:
> > > On Fri, Aug 4, 2017, at 19:54, Tim Cera wrote:
> > > > As noted https://github.com/numpy/numpy/pull/303 a large part of this functionality has been implemented before for numpy and didn't go anywhere because it is already present in scipy.ndimage.
> > > >
> > > > IMHO it is better suited in numpy with a better name so that people don't miss it.
> > >
> > > Is this essentially `scipy.ndimage.generic_filter`?
> > >
> > > Stéfan
> > >
> > > _______________________________________________
> > > NumPy-Discussion mailing list
> > > NumPy-Discussion at python.org
> > > https://mail.python.org/mailman/listinfo/numpy-discussion
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion