blackjax-devs / blackjax

BlackJAX is a Bayesian Inference library designed for ease of use, speed and modularity.
https://blackjax-devs.github.io/blackjax/
Apache License 2.0
806 stars 105 forks source link

Fix MALA transition energy #653

Closed ksnxr closed 6 months ago

ksnxr commented 6 months ago

The current MALA transition energy is implemented incorrectly. In fact, the correct one should be the reverse of the current one.

To see that, note that MALA's log acceptance probability is calculated as prev_energy - new_energy, with new_energy being the transition energy from initial_state to state. As such, the correct new_energy should be -log p(state) - log q(initial_state|state), but the current implementation implements -log p(initial_state) - log q(state|initial_state); the implementation of RWMH seems correct.

Reference: https://en.wikipedia.org/wiki/Metropolis-adjusted_Langevin_algorithm

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.87%. Comparing base (2e25624) to head (3cd525a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #653 +/- ## ======================================= Coverage 98.87% 98.87% ======================================= Files 59 59 Lines 2745 2745 ======================================= Hits 2714 2714 Misses 31 31 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.