Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-21 Thread Sebastian Berg
On Do, 2016-01-21 at 09:38 +, Robert Kern wrote: > On Tue, Jan 19, 2016 at 5:35 PM, Sebastian Berg < > sebast...@sipsolutions.net> wrote: > > > > On Di, 2016-01-19 at 16:28 +, G Young wrote: > > > In rand range, it raises an exception if low >= high. > > > > > > I should also add that AFAIK

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-21 Thread Robert Kern
On Tue, Jan 19, 2016 at 5:35 PM, Sebastian Berg wrote: > > On Di, 2016-01-19 at 16:28 +, G Young wrote: > > In rand range, it raises an exception if low >= high. > > > > I should also add that AFAIK enforcing low >= high with floats is a > > lot trickier than it is for integers. I have been k

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-21 Thread Robert Kern
On Thu, Jan 21, 2016 at 7:06 AM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > > There doesn't seem to be much of a consensus on the way to go, so leaving things as they are and have been seems the wisest choice for now, thanks for all the feedback. I will work with Greg on documenting t

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-20 Thread Jaime Fernández del Río
There doesn't seem to be much of a consensus on the way to go, so leaving things as they are and have been seems the wisest choice for now, thanks for all the feedback. I will work with Greg on documenting the status quo properly. We probably want to follow the lead of the stdlib's random.uniform

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-20 Thread Peter Creasey
>> I would also point out that requiring open vs closed intervals (in >> doubles) is already an extremely specialised use case. In terms of >> *sampling the reals*, there is no difference between the intervals >> (a,b) and [a,b], because the endpoints have measure 0, and even with >> double-precisi

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-20 Thread Charles R Harris
On Wed, Jan 20, 2016 at 11:57 AM, Peter Creasey < p.e.creasey...@googlemail.com> wrote: > +1 for the deprecation warning for low>high, I think the cases where > that is called are more likely to be unintentional rather than someone > trying to use uniform(closed_end, open_end) and you might help u

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-20 Thread Peter Creasey
+1 for the deprecation warning for low>high, I think the cases where that is called are more likely to be unintentional rather than someone trying to use uniform(closed_end, open_end) and you might help users find bugs - i.e. the idioms of ‘explicit is better than implicit’ and ‘fail early and fai

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Chris Barker
On Tue, Jan 19, 2016 at 9:27 AM, Charles R Harris wrote: > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: > >> What does the standard lib do for rand range? I see that randint Is >> closed on both ends, so order doesn't matter, though if it raises f

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread josef.pktd
On Tue, Jan 19, 2016 at 12:43 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Tue, Jan 19, 2016 at 10:42 AM, Robert Kern > wrote: > >> On Tue, Jan 19, 2016 at 5:40 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> > >> > On Tue, Jan 19, 2016 at 10:36 AM, Robert Kern

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Charles R Harris
On Tue, Jan 19, 2016 at 10:42 AM, Robert Kern wrote: > On Tue, Jan 19, 2016 at 5:40 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > > > > On Tue, Jan 19, 2016 at 10:36 AM, Robert Kern > wrote: > >> > >> On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris < > charlesr.har...@gmail.com>

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Robert Kern
On Tue, Jan 19, 2016 at 5:40 PM, Charles R Harris wrote: > > On Tue, Jan 19, 2016 at 10:36 AM, Robert Kern wrote: >> >> On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: >> > >> >> > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < chris.bar...@no

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Robert Kern
On Tue, Jan 19, 2016 at 5:36 PM, Robert Kern wrote: > > On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > > > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: > >> > >> What does the standard lib do for rand rang

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Charles R Harris
On Tue, Jan 19, 2016 at 10:36 AM, Robert Kern wrote: > On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > > > > > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: > >> > >> What does the standard lib do for rand

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Robert Kern
On Tue, Jan 19, 2016 at 5:27 PM, Charles R Harris wrote: > > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: >> >> What does the standard lib do for rand range? I see that randint Is closed on both ends, so order doesn't matter, though if it raises for

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Sebastian Berg
On Di, 2016-01-19 at 16:28 +, G Young wrote: > In rand range, it raises an exception if low >= high. > > I should also add that AFAIK enforcing low >= high with floats is a > lot trickier than it is for integers. I have been knee-deep in > corner cases for some time with randint where numbers

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Charles R Harris
On Tue, Jan 19, 2016 at 10:27 AM, Charles R Harris < charlesr.har...@gmail.com> wrote: > > > On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < > chris.bar...@noaa.gov> wrote: > >> What does the standard lib do for rand range? I see that randint Is >> closed on both ends, so order does

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Charles R Harris
On Tue, Jan 19, 2016 at 9:23 AM, Chris Barker - NOAA Federal < chris.bar...@noaa.gov> wrote: > What does the standard lib do for rand range? I see that randint Is closed > on both ends, so order doesn't matter, though if it raises for b that's a precedent we could follow. > randint is not closed

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Alan G Isaac
In principle, if we are describing an *interval*, that is the right thing to do: https://en.wikipedia.org/wiki/Interval_(mathematics)#Including_or_excluding_endpoints Alan Isaac On 1/19/2016 9:21 AM, G Young wrote: Of the methods defined in *numpy/mtrand.pyx* (excluding helper functions and *

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Chris Barker - NOAA Federal
What does the standard lib do for rand range? I see that randint Is closed on both ends, so order doesn't matter, though if it raises for b wrote: Of the methods defined in *numpy/mtrand.pyx* (excluding helper functions and *random_integers*, as they are all related to *randint*), *randint* is the

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread G Young
In rand range, it raises an exception if low >= high. I should also add that AFAIK enforcing low >= high with floats is a lot trickier than it is for integers. I have been knee-deep in corner cases for some time with *randint* where numbers that are visually different are cast as the same number

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Marten van Kerkwijk
For what it is worth, the current behaviour seems the most logical to me, i.e., that the first limit is always the one that is included in the interval, and the second is not. -- Marten ​ ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https:

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread G Young
Of the methods defined in *numpy/mtrand.pyx* (excluding helper functions and *random_integers*, as they are all related to *randint*), *randint* is the only other function with *low* and *high* parameters. However, it enforces *high* > *low*. Greg On Tue, Jan 19, 2016 at 1:36 PM, Benjamin Root

Re: [Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Benjamin Root
Are there other functions where this behavior may or may not be happening? If it isn't consistent across all np.random functions, it probably should be, one way or the other. Ben Root On Tue, Jan 19, 2016 at 5:10 AM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > Hi all, > > There is a

[Numpy-discussion] Behavior of np.random.uniform

2016-01-19 Thread Jaime Fernández del Río
Hi all, There is a PR (#7026 ) that documents the current behavior of np.random.uniform when the low and high parameters it takes do not conform to the expected low < high. Basically: - if low < high, random numbers are drawn from [low, high), - if