Repository navigation
TST: stats.cosine: modify test to silence failure - #18382
Conversation
|
@ilayn That failure in x = [-np.pi, np.pi]
c = np.cos(x)
np.testing.assert_equal(c, -1)fails. I think that sort of change would cause problems in other libraries, too. Should we report to NumPy? |
|
I think I'm looking at the wrong place maybe but I am reading as the mismatch and not the element. Is that correct? |
|
In this PR, the failure is in the revised line 8764: revealing that the failure you mentioned is actually due to a change in the value returned by |
|
Ah OK. this revealed a different issue. I think indeed should invalidate the assertion. We should probably test the size too anyways. |
|
I'm confused. It sounds like you're saying that the assertion fails because they are of different shapes, but It says that it's failing because the results of My question was whether you agree this is something to report to NumPy. My question was whether you agree this is something to report to NumPy. It looks like it could be a bug in NumPy |
|
Oh maybe linked to numpy/numpy#23399 ??? I think Astropy could be seeing the same thing astropy/astropy#14705 |
|
Ah then I got what you mean now, sorry for my confusion. That value is just floating number jitter. If you look at the eps value, np.spacing(1.)
Out[3]: 2.220446049250313e-16which is the smallest number you can distinguish a float from another differing that amount. That's why typically you don't do Why suddenly we started seeing is probably due to what @tupui mentioned, that they fiddled with some internals of trig funcs. |
|
Re: astropy -- it might have broken some stuff in |
I know. However, with something as fundamental as |
|
Well I would argue that the equal shoudn't have been used for any float comparison anyways. That would fix this issue at hand but losing this convenience is a different discussion. |
|
Following that, |
|
For certain float values What I mean is this type of stuff should work Think of equal as a bit-level comparison. If ULP guarantees become loose, then you can't pull the comparison off with |
|
@mdhaber What do you think? Should we move forward with the |
|
You mean scipy/scipy/stats/_continuous_distns.py Lines 1466 to 1470 in c1ed5ec That would stop the test from complaining, but it's unclear whether that is the best fix. There is no need for the result of Then again, I suppose I would prefer for the |
|
With cf373ac in #18402 I was able to get down to one failure: AIUI, this is similarly due to numpy/numpy#23399. Seems there's not much but to patch our tests to have less sharp expectations. |
|
As the original author of that overly optimistic test, I'm happy to fix the issue. But the fix that I have in mind is more radical than just tweaking the test. The true 64 bit floating point value for The fix that I have in mind will update both the pdf and logpdf methods to provide much more accurate values in the neighborhoods of What I have in mind is to implement the pdf and/or logpdf methods as a ufunc, similar to what I did for the cdf method in #10170. |
|
I think we need something to get CI green in the meantime. (Also, personally, I would not be interested in improving the accuracy of the @h-vetinari you suggested giving the test "less sharp expectations". This does that by ensuring that the resulting |
Agreed. This is a one-line fix, and a follow-up issue can be opened for a more desirable change in the longer term. Let's merge this, and follow up on it at a more leisurely pace later? |
h-vetinari
left a comment
There was a problem hiding this comment.
Agreed with the approach to unblock this now and iterate more calmly later. 👍
Thanks!
|
In it goes. I'm looking at the related failures in |
Reference issue
gh-18358
#18379 (comment)
What does this implement/fix?
Investigating one of the Linux Meson tests / Meson build 3.11 test failures noted in gh-18358.