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

SMC Inner kernel tuning #595

Merged

Conversation

ciguaran
Copy link
Contributor

@ciguaran ciguaran commented Nov 30, 2023

  • Tunes the parameters of the inner kernel (mutation) inside SMC, based on the output of the previous step (state and sampling info).
    See Design choice (c) of section 2.1.3 from https://arxiv.org/abs/1808.07730.
  • Implements some tuning:
  1. inverse mass matrix from particles (useful for HMC)
  2. mean, std and covariance from particles (useful for IRMH)
  3. scale based on acceptance rate

See sampling-notebook PR: blackjax-devs/sampling-book#49

Previously discussed here: #245

A few important guidelines and requirements before we can merge your PR:

  • [Y] If I add a new sampler, there is an issue discussing it already;
  • [Y] We should be able to understand what the PR does from its title only;
  • [Y] There is a high-level description of the changes;
  • [Y] There are links to all the relevant issues, discussions and PRs;
  • [Y ] The branch is rebased on the latest main commit;
  • [Y] Commit messages follow these guidelines;
  • [Y] The code respects the current naming conventions;
  • [Y] Docstrings follow the numpy style guide
  • [Y] pre-commit is installed and configured on your machine, and you ran it before opening the PR;
  • [Y] There are tests covering the changes;
  • [Y] The doc is up-to-date;
  • [Y] If I add a new sampler* I added/updated related examples

Copy link

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0a84b22) 99.16% compared to head (ab46961) 99.18%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #595      +/-   ##
==========================================
+ Coverage   99.16%   99.18%   +0.01%     
==========================================
  Files          54       57       +3     
  Lines        2513     2563      +50     
==========================================
+ Hits         2492     2542      +50     
  Misses         21       21              

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

Copy link
Member

@junpenglao junpenglao left a comment

Choose a reason for hiding this comment

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

Great work! Only minor comments.

blackjax/smc/optimizations/from_kernel_info.py Outdated Show resolved Hide resolved
blackjax/smc/optimizations/from_kernel_info.py Outdated Show resolved Hide resolved
blackjax/smc/optimizations/from_particles.py Outdated Show resolved Hide resolved
blackjax/smc/optimizations/from_particles.py Outdated Show resolved Hide resolved
blackjax/smc/optimizations/__init__.py Outdated Show resolved Hide resolved
blackjax/smc/inner_kernel_tuning.py Outdated Show resolved Hide resolved
blackjax/smc/inner_kernel_tuning.py Outdated Show resolved Hide resolved
blackjax/smc/inner_kernel_tuning.py Outdated Show resolved Hide resolved
tests/smc/test_inner_kernel_tuning.py Outdated Show resolved Hide resolved
tests/smc/test_inner_kernel_tuning.py Show resolved Hide resolved
@ciguaran ciguaran mentioned this pull request Dec 4, 2023
10 tasks
Copy link
Member

@junpenglao junpenglao left a comment

Choose a reason for hiding this comment

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

Great work! Last bit of nitpick :-)

@junpenglao junpenglao merged commit 6df7245 into blackjax-devs:main Dec 6, 2023
7 checks passed
junpenglao added a commit that referenced this pull request Mar 12, 2024
* inner kernel tuning, tests, and some common strategies

* Adding imports

* pre-commit

* code review updates

* Adding Chex tests

* line alignment comment

* Adding particles_as_rows test

* Modifying implementation of particles_as_rows

* pre-commit

* change in inverse_mass_matrix from particles implementation

* replacing particles_as_rows_test

---------

Co-authored-by: Junpeng Lao <junpenglao@gmail.com>
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