-
Notifications
You must be signed in to change notification settings - Fork 16
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
nlive calculation bug fix #119
Conversation
@lukashergt, this likely has implications for your work concerning re-weighting/slicing of nested sampling chains. It would likely be worth your pushing a PR with a failing test that captures that behaviour, which we can check if merging this provides a fix. |
Codecov Report
@@ Coverage Diff @@
## master #119 +/- ##
==========================================
+ Coverage 91.98% 92.72% +0.74%
==========================================
Files 16 16
Lines 1460 1458 -2
==========================================
+ Hits 1343 1352 +9
+ Misses 117 106 -11
Continue to review full report at Codecov.
|
I'm not sure I can turn this into a failing test. What I have done is infer the evidence in two separate ways:
Should I expect that |
Or at least that they're close to within the error margins of ns_output. Basically it would be good to do this for a standard example (e.g. on one of the ones in tests/example_data). |
I'm not that up to speed with the anesthetic codebase, but I have checked that the Let me know if you want the MN run files or more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loooks good, a couple of very small comments
@andrewfowlie if you're happy with the trimming down of the code, could you re-approve the PR so it can be merged? @lukashergt let me know if you have any problem with/comments on this merge. |
as the coverage checks were failing with the minor reorganisation I also added a couple of tests to bring us up to 100% coverage of samples. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to have a version update for this PR (2.0.0b2) such that we can easier reference these changes later.
Other than that I'm not sure whether this indicates that there might be an over-correction, such that there still is an off-by-one error and whether that should be addressed here, or in #120.
Done, and I made 2.0.0-beta.1 an actual beta release with a tag.
I plan to look quite carefully now at #120, as it's not impossible that off-by-one errors remain. As @andrewfowlie is in NZ and likely asleep by now, could @lukashergt re-approve the version bump. |
Description
There is an off-by-one nlive bug that has been lurking for a while. This is most clearly seen in likelihoods with plateau regions, but has also been occuring in the computation of decreasing nlive values for the final set of live points.
In anesthetic, nlive is a column in the table, and therefore 'belongs' to the point corresponding to a row. It is used to compute the volume compression via the probability distribution:
n_i
therefore corresponds to the number of live points for which row i is the lowest likelihood live point. This means for example that the final point at the end of a run should have nlive=1, not 0.This PR adjusts the tests so that the values are correct, introduces a failing test for a 'wedding cake' likelihood, which is then fixed by subsequent commits
Checklist:
flake8 anesthetic tests
)pydocstyle --convention=numpy anesthetic
)python -m pytest
)