Skip to content

looser numeric tolerance for TestUtils.test_interface #455

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

Merged
merged 11 commits into from
Apr 19, 2022
Merged

Conversation

st--
Copy link
Member

@st-- st-- commented Apr 14, 2022

  • fixes the docstring
  • adds rtol specification where atol is also specified

@st-- st-- requested a review from willtebbutt April 14, 2022 12:43
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

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

I'm happy for this to be merged, subject to resolving my comment, CI passing, and a patch bump being made.

st-- and others added 2 commits April 14, 2022 16:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: willtebbutt <[email protected]>
@codecov
Copy link

codecov bot commented Apr 14, 2022

Codecov Report

Merging #455 (d961d40) into master (033daf2) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #455   +/-   ##
=======================================
  Coverage   93.18%   93.18%           
=======================================
  Files          52       52           
  Lines        1261     1261           
=======================================
  Hits         1175     1175           
  Misses         86       86           
Impacted Files Coverage Δ
src/KernelFunctions.jl 100.00% <ø> (ø)
src/TestUtils.jl 94.11% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 033daf2...d961d40. Read the comment docs.

@st--
Copy link
Member Author

st-- commented Apr 14, 2022

Looks like this hasn't resolved the test issue 😞 should we just bump the default rtol then ?

@devmotion
Copy link
Member

Yeah that's what I expected unfortunately. According to the logs in the other PR for the failing tests rtol was already specified. I think the default values for the atol = 0 case would make sense, ie. rtol = sqrt(eps(T)). (Probably it would also make sense to use a T-dependent atol but could be done separately if needed at some point.)

src/TestUtils.jl Outdated
@@ -1,7 +1,7 @@
module TestUtils

const __ATOL = 1e-9
const __RTOL = 1e-9
const __ATOL = sqrt(eps(Float64))
Copy link
Member

Choose a reason for hiding this comment

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

Is this change required? I would assume changing rtol to the default value for atol = 0 (i.e., sqrt(eps(T))) is sufficient. atol should only be needed when checking approximate equality involving an exact zero which I assume doesn't happen and I guess is fine with lower tolerances such as 1e-9.

Copy link
Member Author

Choose a reason for hiding this comment

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

🤷 maybe not? I didn't think too much about it; we didn't carefully assess the tolerances to check whether atol=1e-9 is neeeded, or 1e-10 is enough... and sqrt(eps(Float64)) is ~2e-8 so not much of a change and it seemed nicely symmetric. Anyways, happy to change it back if (atol, rtol) = (1e-9, 2e-8) is better. What do you think @willtebbutt ?

Copy link
Member

Choose a reason for hiding this comment

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

To my mind the point of the tests is to pick up on really substantial issues with a kernel implementation (i.e. substantial asymmetry in the kernel matrix, large negative eigenvalues), rather than to test that the numerics, as that presumably has to be a kernel-specific thing. Consequently, I'm happy with the looser atol that @st-- proposes.

@st-- is also correct that 1e-9 was chosen for no particular reason other than it seemed to satisfy the above in the cases we tested.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I'm going to add that as a comment though to make it easier to understand in the future

@st-- st-- changed the title Improve test_interface tests and docstring looser numeric tolerance for TestUtils.test_interface Apr 19, 2022
@st-- st-- merged commit 35de8d2 into master Apr 19, 2022
@st-- st-- deleted the st/kernelmatrixtest branch April 19, 2022 16:38
@devmotion devmotion mentioned this pull request Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants