Questions regarding the code for Metropolis-adjusted Langevin
Wenlin-Chen opened this issue · 1 comments
Wenlin-Chen commented
Hi, thanks for the repo! I have three questions regarding the code for Metropolis-adjusted Langevin:
-
When a proposal is rejected, why is the gradient not reset (i.e.,
self.grad[1].data = self.grad[0].data
)?
Langevin-dynamics/langevin_sampling/samplers.py
Lines 212 to 214 in 495de3a
-
When computing the density of the proposal distribution, why is
P[1]
used for both directions? Shouldn't it beP[idx^1]
?
Langevin-dynamics/langevin_sampling/samplers.py
Lines 228 to 233 in 495de3a
-
Why are the rejected samples discarded? Shouldn't MH keep both accepted and rejected samples in the list?
alisiahkoohi commented
grad[0]
represents the gradient in the last accepted sample, and the gradient in the unaccepted sample is not required anymore.- What is meant by "direction"?
P[1]
(preconditioner) acts as the (squared) covariance of the additive noise distribution at the proposed sample and needed for computing the acceptance ratio. - The rejected samples themselves are not needed but the duplicates of the accepted samples per rejection might be saved. Feel free to submit a pull request with pointers to references in the comments.