Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Ralf Gommers
On Tue, Jul 16, 2013 at 3:50 AM, Charles R Harris wrote: > > > On Mon, Jul 15, 2013 at 6:58 PM, Benjamin Root wrote: > >> To add a bit of context to the question of nansum on empty results, we >> currently differ from MATLAB and R in this respect, they return zero no >> matter what. Personally,

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 6:58 PM, Benjamin Root wrote: > To add a bit of context to the question of nansum on empty results, we > currently differ from MATLAB and R in this respect, they return zero no > matter what. Personally, I think it should return zero, but our current > behavior of returnin

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Benjamin Root
To add a bit of context to the question of nansum on empty results, we currently differ from MATLAB and R in this respect, they return zero no matter what. Personally, I think it should return zero, but our current behavior of returning nans has existed for a long time. Personally, I think we need

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Stéfan van der Walt
On Mon, 15 Jul 2013 18:46:33 -0600, Charles R Harris wrote: > So nansum should return zeros rather than the current NaNs? Yes, my feeling is that nansum([]) should be 0. Stéfan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.s

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 6:22 PM, Stéfan van der Walt wrote: > On Mon, 15 Jul 2013 08:33:47 -0600, Charles R Harris wrote: > > On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root wrote: > > > > > This is going to need to be heavily documented with doctests. Also, > just > > > to clarify, are we talking

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Stéfan van der Walt
On Mon, 15 Jul 2013 08:33:47 -0600, Charles R Harris wrote: > On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root wrote: > > > This is going to need to be heavily documented with doctests. Also, just > > to clarify, are we talking about a ValueError for doing a nansum on an > > empty array as well, or

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 3:57 PM, wrote: > On Mon, Jul 15, 2013 at 5:34 PM, Charles R Harris > wrote: > > > > > > On Mon, Jul 15, 2013 at 2:44 PM, wrote: > >> > >> On Mon, Jul 15, 2013 at 4:24 PM, wrote: > >> > On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith > wrote: > >> >> On Mon, Jul 15,

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread josef . pktd
On Mon, Jul 15, 2013 at 5:34 PM, Charles R Harris wrote: > > > On Mon, Jul 15, 2013 at 2:44 PM, wrote: >> >> On Mon, Jul 15, 2013 at 4:24 PM, wrote: >> > On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith wrote: >> >> On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris >> >> wrote: >> >>> Let me

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 2:44 PM, wrote: > On Mon, Jul 15, 2013 at 4:24 PM, wrote: > > On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith wrote: > >> On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris > >> wrote: > >>> Let me try to summarize. To begin with, the environment of the nan > functions

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread josef . pktd
On Mon, Jul 15, 2013 at 4:24 PM, wrote: > On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith wrote: >> On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris >> wrote: >>> Let me try to summarize. To begin with, the environment of the nan functions >>> is rather special. >>> >>> 1) if the array is of

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread josef . pktd
On Mon, Jul 15, 2013 at 2:55 PM, Nathaniel Smith wrote: > On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris > wrote: >> Let me try to summarize. To begin with, the environment of the nan functions >> is rather special. >> >> 1) if the array is of not of inexact type, they punt to the non-nan >> v

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Nathaniel Smith
On Mon, Jul 15, 2013 at 6:29 PM, Charles R Harris wrote: > Let me try to summarize. To begin with, the environment of the nan functions > is rather special. > > 1) if the array is of not of inexact type, they punt to the non-nan > versions. > 2) if the array is of inexact type, then out and dtype

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 9:55 AM, Sebastian Berg wrote: > On Mon, 2013-07-15 at 08:47 -0600, Charles R Harris wrote: > > > > > > On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg > > wrote: > > On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: > > > > > > > >

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Sebastian Berg
On Mon, 2013-07-15 at 08:47 -0600, Charles R Harris wrote: > > > On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg > wrote: > On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: > > > > > > On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris > > wrote:

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Benjamin Root
On Jul 15, 2013 11:47 AM, "Charles R Harris" wrote: > > > On Mon, Jul 15, 2013 at 8:58 AM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg < >> sebast...@sipsolutions.net> wrote: >> >>> On Mon, 2013-07-15 at 07:52 -0600, Charles R

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 8:58 AM, Charles R Harris wrote: > > > On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg < > sebast...@sipsolutions.net> wrote: > >> On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: >> > >> > >> > On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris >> > wrote: >> >

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg wrote: > On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: > > > > > > On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris > > wrote: > > > > > > > > > For nansum, I would expect 0 even in the case of all > >

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 8:34 AM, Sebastian Berg wrote: > On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: > > > > > > On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris > > wrote: > > > > > > > > > For nansum, I would expect 0 even in the case of all > >

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Mon, Jul 15, 2013 at 8:25 AM, Benjamin Root wrote: > This is going to need to be heavily documented with doctests. Also, just > to clarify, are we talking about a ValueError for doing a nansum on an > empty array as well, or will that now return a zero? > > I was going to leave nansum as is, a

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Sebastian Berg
On Mon, 2013-07-15 at 07:52 -0600, Charles R Harris wrote: > > > On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris > wrote: > > > For nansum, I would expect 0 even in the case of all > nans. The point > of these functi

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Benjamin Root
This is going to need to be heavily documented with doctests. Also, just to clarify, are we talking about a ValueError for doing a nansum on an empty array as well, or will that now return a zero? Ben Root On Mon, Jul 15, 2013 at 9:52 AM, Charles R Harris wrote: > > > On Sun, Jul 14, 2013 at 3

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-15 Thread Charles R Harris
On Sun, Jul 14, 2013 at 3:35 PM, Charles R Harris wrote: > > > On Sun, Jul 14, 2013 at 2:55 PM, Warren Weckesser < > warren.weckes...@gmail.com> wrote: > >> On 7/14/13, Charles R Harris wrote: >> > Some corner cases in the mean, var, std. >> > >> > *Empty arrays* >> > >> > I think these cases sh

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-14 Thread Charles R Harris
On Sun, Jul 14, 2013 at 2:55 PM, Warren Weckesser < warren.weckes...@gmail.com> wrote: > On 7/14/13, Charles R Harris wrote: > > Some corner cases in the mean, var, std. > > > > *Empty arrays* > > > > I think these cases should either raise an error or just return nan. > > Warnings seem ineffecti

Re: [Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-14 Thread Warren Weckesser
On 7/14/13, Charles R Harris wrote: > Some corner cases in the mean, var, std. > > *Empty arrays* > > I think these cases should either raise an error or just return nan. > Warnings seem ineffective to me as they are only issued once by default. > > In [3]: ones(0).mean() > /home/charris/.local/li

[Numpy-discussion] What should be the result in some statistics corner cases?

2013-07-14 Thread Charles R Harris
Some corner cases in the mean, var, std. *Empty arrays* I think these cases should either raise an error or just return nan. Warnings seem ineffective to me as they are only issued once by default. In [3]: ones(0).mean() /home/charris/.local/lib/python2.7/site-packages/numpy/core/_methods.py:61: