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

Bayes factor Tutorial #1444

Merged
merged 37 commits into from
Sep 12, 2024
Merged

Bayes factor Tutorial #1444

merged 37 commits into from
Sep 12, 2024

Conversation

arrjon
Copy link
Contributor

@arrjon arrjon commented Aug 7, 2024

Adding some new methods to compute marginal likelihoods and Bayes Factors. This inclues:

  • Laplace Approximation
  • Harmonic Mean Estimators and Variants
  • Bridge Sampling
  • Steppingstone Sampling

I also created a notebook explaining how to use these (and other methods already available in pypesto).

@arrjon arrjon added the enhancement New feature or request label Aug 7, 2024
@arrjon arrjon self-assigned this Aug 7, 2024
@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 92.45283% with 12 lines in your changes missing coverage. Please review.

Project coverage is 83.46%. Comparing base (0465922) to head (0d549c2).

Files with missing lines Patch % Lines
pypesto/sample/evidence.py 92.80% 10 Missing ⚠️
pypesto/sample/dynesty.py 81.81% 2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1444      +/-   ##
===========================================
+ Coverage    83.34%   83.46%   +0.12%     
===========================================
  Files          159      160       +1     
  Lines        13356    13473     +117     
===========================================
+ Hits         11131    11245     +114     
- Misses        2225     2228       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arrjon arrjon marked this pull request as ready for review August 12, 2024 14:27
Just some typos.
Copy link
Contributor

@vwiela vwiela left a comment

Choose a reason for hiding this comment

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

From my side this looks good now and is a nice enhancement. Thanks.

Copy link
Collaborator

@PaulJonasJost PaulJonasJost left a comment

Choose a reason for hiding this comment

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

Thanks for the addition.

doc/authors.rst Show resolved Hide resolved
test/sample/test_sample.py Outdated Show resolved Hide resolved
test/sample/test_sample.py Show resolved Hide resolved
test/optimize/test_optimize.py Outdated Show resolved Hide resolved
test/optimize/test_optimize.py Outdated Show resolved Hide resolved
pypesto/sample/util.py Outdated Show resolved Hide resolved
pypesto/sample/util.py Outdated Show resolved Hide resolved
pypesto/sample/util.py Outdated Show resolved Hide resolved
pypesto/sample/parallel_tempering.py Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
Copy link
Contributor

@Doresic Doresic left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for the implementations!

doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
pypesto/sample/estimate_evidence.py Outdated Show resolved Hide resolved
@arrjon
Copy link
Contributor Author

arrjon commented Sep 4, 2024

@dilpath what do you think?

Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

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

I agree with Domagoj, the notebook is great, and thanks for adding so many methods for computing the marginal likelihood. Looks great!

doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
" \n",
" if 'true_params' in m.keys():\n",
" visualize.parameters(\n",
" results=m['results'], reference={'x': m[\"true_params\"], 'fval': m['problem'].objective(m[\"true_params\"])})\n",
Copy link
Member

Choose a reason for hiding this comment

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

This line and many others are cut-off by the width of the rendered notebook.

@PaulJonasJost do we have some ruff to auto-format notebook code to e.g. 80 characters per line?

doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
pypesto/sample/util.py Outdated Show resolved Hide resolved
test/run_notebook.sh Outdated Show resolved Hide resolved
test/sample/test_sample.py Outdated Show resolved Hide resolved
doc/example/bayes_factors.ipynb Outdated Show resolved Hide resolved
pypesto/sample/estimate_evidence.py Outdated Show resolved Hide resolved
@arrjon arrjon merged commit fd652e8 into develop Sep 12, 2024
18 checks passed
@arrjon arrjon deleted the bayes_factor_tutorial branch September 12, 2024 10:38
This was referenced Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants