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

Perfect nested sampling functionality #205

Merged
merged 32 commits into from
Jan 27, 2023
Merged

Conversation

williamjameshandley
Copy link
Collaborator

Description

A set of scripts for generating perfect nested sampling runs which will prove useful in developing techniques such as importance sampling #132.

Changes:

  1. Implemented a spherical gaussian as found in John Skilling's original paper
  2. Implemented a correlated gaussian, which can be used to simulate cosmological likelihoods
  3. Moved the wedding cake class into a function in the same framework as the two above

Checklist:

  • I have performed a self-review of my own code
  • My code is PEP8 compliant (flake8 anesthetic tests)
  • My code contains compliant docstrings (pydocstyle --convention=numpy anesthetic)
  • New and existing unit tests pass locally with my changes (python -m pytest)
  • I have added tests that prove my fix is effective or that my feature works

@williamjameshandley williamjameshandley added this to the 2.1.0 milestone Aug 9, 2022
@codecov
Copy link

codecov bot commented Aug 9, 2022

Codecov Report

Merging #205 (62d2c17) into master (ba7d4b3) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##            master      #205    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           26        29     +3     
  Lines         2303      2422   +119     
==========================================
+ Hits          2303      2422   +119     
Impacted Files Coverage Δ
anesthetic/examples/_matplotlib_agg.py 100.00% <100.00%> (ø)
anesthetic/examples/perfect_ns.py 100.00% <100.00%> (ø)
anesthetic/examples/utils.py 100.00% <100.00%> (ø)
anesthetic/samples.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@williamjameshandley williamjameshandley self-assigned this Aug 17, 2022
lukashergt
lukashergt previously approved these changes Dec 22, 2022
Copy link
Collaborator

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

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

This could indeed be useful. Did you intend to add more to this or is this ready for review?

See comments inline.

anesthetic/examples/__init__.py Outdated Show resolved Hide resolved
anesthetic/examples/perfect_ns.py Outdated Show resolved Hide resolved
anesthetic/examples/utils.py Outdated Show resolved Hide resolved
anesthetic/examples/perfect_ns.py Show resolved Hide resolved
anesthetic/examples/utils.py Outdated Show resolved Hide resolved
@williamjameshandley williamjameshandley modified the milestones: 2.1.0, 2.0.0 Jan 17, 2023
@williamjameshandley
Copy link
Collaborator Author

I have added a planck gaussian example (anesthetic.examples.planck_gaussian) which produces a gaussian likelihood in 6 cosmological parameters with the correct labels, mean, covariance and normalisation.

One subtlety is that this would not give the same evidence as a full planck run, but we could choose this normalisation a-la-nuisance marginalised likelihoods.

In addition I corrected a bug which testing this threw up (a factor of 2 in the d_G) and improved the efficiency of generating these perfect nested sampling runs (namely updating the bounds on the uniform step, and fixing a bug where previously the bounds were assumed to be 0 and 1 for the elliptical step). These proved essential in making this efficient enough to work with 6 parameters.

It is too inefficient with all nuisance parameters sadly.

@williamjameshandley
Copy link
Collaborator Author

This will also be useful for removing demo.py in #246.

Copy link
Collaborator

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

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

See comments inline.

tests/test_examples.py Outdated Show resolved Hide resolved
anesthetic/examples/utils.py Outdated Show resolved Hide resolved
anesthetic/examples/utils.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@lukashergt lukashergt left a comment

Choose a reason for hiding this comment

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

Great! Thanks @williamjameshandley, please squash and merge.

@williamjameshandley williamjameshandley merged commit 394712c into master Jan 27, 2023
@williamjameshandley williamjameshandley deleted the perfect_ns branch January 27, 2023 08:30
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.

2 participants