Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Thu, Jul 17, 2014 at 4:21 PM, josef.p...@gmail.com wrote: On Thu, Jul 17, 2014 at 4:07 PM, josef.p...@gmail.com wrote: On Wed, Jul 16, 2014 at 9:52 AM, Nathaniel Smith n...@pobox.com wrote: On 16 Jul 2014 10:26, Tony Yu tsy...@gmail.com wrote: Is there any reason why the

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Wed, Jul 16, 2014 at 9:52 AM, Nathaniel Smith n...@pobox.com wrote: On 16 Jul 2014 10:26, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More importantly, using an

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Thu, Jul 17, 2014 at 4:07 PM, josef.p...@gmail.com wrote: On Wed, Jul 16, 2014 at 9:52 AM, Nathaniel Smith n...@pobox.com wrote: On 16 Jul 2014 10:26, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Nathaniel Smith
On Wed, Jul 16, 2014 at 7:47 PM, Ralf Gommers ralf.gomm...@gmail.com wrote: On Wed, Jul 16, 2014 at 6:37 AM, Tony Yu tsy...@gmail.com wrote: It seems like the defaults for `allclose` and `assert_allclose` should match, and an absolute tolerance of 0 is probably not ideal. I guess this is a

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Nathaniel Smith
On Thu, Jul 17, 2014 at 9:07 PM, josef.p...@gmail.com wrote: On Wed, Jul 16, 2014 at 9:52 AM, Nathaniel Smith n...@pobox.com wrote: What you say makes sense to me, and loosening the default tolerances won't break any existing tests. (And I'm not too worried about people who were counting on

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Tony Yu
On Wed, Jul 16, 2014 at 1:47 PM, Ralf Gommers ralf.gomm...@gmail.com wrote: On Wed, Jul 16, 2014 at 6:37 AM, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Thu, Jul 17, 2014 at 4:07 PM, josef.p...@gmail.com wrote: On Wed, Jul 16, 2014 at 9:52 AM, Nathaniel Smith n...@pobox.com wrote: On 16 Jul 2014 10:26, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Thu, Jul 17, 2014 at 11:37 AM, Nathaniel Smith n...@pobox.com wrote: On Wed, Jul 16, 2014 at 7:47 PM, Ralf Gommers ralf.gomm...@gmail.com wrote: On Wed, Jul 16, 2014 at 6:37 AM, Tony Yu tsy...@gmail.com wrote: It seems like the defaults for `allclose` and `assert_allclose` should

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Nathaniel Smith
On Fri, Jul 18, 2014 at 12:38 PM, josef.p...@gmail.com wrote: On Thu, Jul 17, 2014 at 4:07 PM, josef.p...@gmail.com wrote: If you mean by this to add atol=1e-8 as default, then I'm against it. At least it will change the meaning of many of our tests in statsmodels. I'm using rtol to check

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Chris Barker
On Fri, Jul 18, 2014 at 9:53 AM, Nathaniel Smith n...@pobox.com wrote: I don't know what the usecases for np.allclose are since I don't have any. I use it all the time -- sometimes you want to check something, but not raise an assertion -- and I use it like: assert np.allclose() with

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Fri, Jul 18, 2014 at 2:03 PM, josef.p...@gmail.com wrote: On Fri, Jul 18, 2014 at 12:53 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Jul 18, 2014 at 12:38 PM, josef.p...@gmail.com wrote: On Thu, Jul 17, 2014 at 4:07 PM, josef.p...@gmail.com wrote: If you mean by this to add

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Fri, Jul 18, 2014 at 2:29 PM, Nathaniel Smith n...@pobox.com wrote: On Fri, Jul 18, 2014 at 7:03 PM, josef.p...@gmail.com wrote: On Fri, Jul 18, 2014 at 12:53 PM, Nathaniel Smith n...@pobox.com wrote: For cases like this, you need *some* non-zero atol or the thing just doesn't

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Nathaniel Smith
On 18 Jul 2014 19:31, josef.p...@gmail.com wrote: Making the behavior of assert_allclose depending on whether desired is exactly zero or 1e-20 looks too difficult to remember, and which desired I use would depend on what I get out of R or Stata. I thought your whole point here was that

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Pauli Virtanen
18.07.2014 21:03, josef.p...@gmail.com kirjoitti: [clip] Of course you can change it. But the testing functions are code and very popular code. And if you break backwards compatibility, then I wouldn't mind reviewing a pull request for statsmodels that adds 300 to 400 `atol=0` to the unit

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread josef . pktd
On Fri, Jul 18, 2014 at 2:44 PM, Nathaniel Smith n...@pobox.com wrote: On 18 Jul 2014 19:31, josef.p...@gmail.com wrote: Making the behavior of assert_allclose depending on whether desired is exactly zero or 1e-20 looks too difficult to remember, and which desired I use would

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Chris Barker
On Fri, Jul 18, 2014 at 11:47 AM, Pauli Virtanen p...@iki.fi wrote: Using allclose in non-test code without specifying both tolerances explicitly is IMHO a sign of sloppiness, as the default tolerances are both pretty big (and atol != 0 is not scale-free). using it without specifying

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Pauli Virtanen
18.07.2014 22:13, Chris Barker kirjoitti: [clip] but an appropriate rtol would work there too. If only zero testing is needed, then atol=0 makes sense as a default. (or maybe atol=eps) There's plenty of room below eps, but finfo(float).tiny ~ 3e-308 (or some big multiple) is also reasonable in

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread Charles R Harris
On Fri, Jul 18, 2014 at 2:32 PM, Chris Barker chris.bar...@noaa.gov wrote: On Fri, Jul 18, 2014 at 12:43 PM, Pauli Virtanen p...@iki.fi wrote: 18.07.2014 22:13, Chris Barker kirjoitti: [clip] but an appropriate rtol would work there too. If only zero testing is needed, then atol=0 makes

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-18 Thread alex
On Fri, Jul 18, 2014 at 9:47 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Fri, Jul 18, 2014 at 2:32 PM, Chris Barker chris.bar...@noaa.gov wrote: On Fri, Jul 18, 2014 at 12:43 PM, Pauli Virtanen p...@iki.fi wrote: 18.07.2014 22:13, Chris Barker kirjoitti: [clip] but an

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-17 Thread Ralf Gommers
On Wed, Jul 16, 2014 at 6:37 AM, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More importantly, using an absolute tolerance of 0 causes failures for some common cases.

Re: [Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-17 Thread Nathaniel Smith
On 16 Jul 2014 10:26, Tony Yu tsy...@gmail.com wrote: Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More importantly, using an absolute tolerance of 0 causes failures for some common cases. For example,

[Numpy-discussion] `allclose` vs `assert_allclose`

2014-07-16 Thread Tony Yu
Is there any reason why the defaults for `allclose` and `assert_allclose` differ? This makes debugging a broken test much more difficult. More importantly, using an absolute tolerance of 0 causes failures for some common cases. For example, if two values are very close to zero, a test will fail: