Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Update unreliable num precision component of test_binary_arith_ops (GH37328) #37380

Merged
merged 5 commits into from
Oct 28, 2020

Conversation

avinashpancham
Copy link
Contributor

@avinashpancham
Copy link
Contributor Author

avinashpancham commented Oct 24, 2020

Seems like a numerical precision issue indeed.

Comparing the values: 16.964677878827604 and 16.964677878827608 I get the following tolerance levels:
Max absolute difference: 3.55271368e-15
Max relative difference: 2.09418281e-16

Therefore I changed: tm.assert_numpy_array_equal(result.values, expected) to tm.assert_almost_equal(result.values, expected, atol=1e-14, rtol=1e-15)

@avinashpancham
Copy link
Contributor Author

I see that this issue is not limited to those values, I also get this error on #36838, where there's a mismatch between 0.8129387113107932 and 0.8129387113107933

The proposed change would catch it, but maybe we will need to relax the tolerances more to make it generic.

@dsaxton
Copy link
Member

dsaxton commented Oct 25, 2020

@avinashpancham Merging master should fix the linting error

@rhshadrach
Copy link
Member

xref #13339 which changed the first assert in check_binary_arith_op to assert_almost_equal. Make sense we would need to do the same here.

@avinashpancham
Copy link
Contributor Author

@rhshadrach sorry but I dont understand what you mean. Could you maybe give some more explanation?

@avinashpancham
Copy link
Contributor Author

@dsaxton thanks that solved it indeed

@avinashpancham
Copy link
Contributor Author

@rhshadrach sorry but I dont understand what you mean. Could you maybe give some more explanation?

Now that I read it again it looks more like a general comment, instead of feedback. My bad.

@avinashpancham
Copy link
Contributor Author

CI failed due to: RuntimeError: can't start new thread. Would it be possible for someone to restart the CI?

@simonjayhawkins
Copy link
Member

CI failed due to: RuntimeError: can't start new thread. Would it be possible for someone to restart the CI?

restarted.

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jreback jreback added the Testing pandas testing functions or related to the test suite label Oct 28, 2020
@jreback jreback added this to the 1.2 milestone Oct 28, 2020
@jreback
Copy link
Contributor

jreback commented Oct 28, 2020

cc @jbrockmendel this seems reasonble to me.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls merge master and ping on green.

# direct numpy comparison
expected = self.ne.evaluate(f"nlhs {op} ghs")
tm.assert_numpy_array_equal(result.values, expected)
tm.assert_almost_equal(result.values, expected)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a comment why we are doing this and reference to this issue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yah i think this makes sense, but should have a TODO indicating that it should be equality and we had to punt

@avinashpancham
Copy link
Contributor Author

@jreback merged master and CI is greenish. Errors are memory/OS errors unrelated to this change, do we want to run this again or is this fine?

@jreback jreback merged commit d321be6 into pandas-dev:master Oct 28, 2020
@jreback
Copy link
Contributor

jreback commented Oct 28, 2020

thanks @avinashpancham

kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
ukarroum pushed a commit to ukarroum/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TST: eval test unreliable
6 participants