alisiahkoohi / langevin-dynamics Goto Github PK
View Code? Open in Web Editor NEWSampling with gradient-based Markov Chain Monte Carlo approaches
License: MIT License
Sampling with gradient-based Markov Chain Monte Carlo approaches
License: MIT License
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 isP[1]
used for both directions? Shouldn't it be P[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?
Hi,
Thank you so much for the repository. I am learning MCMC. It's really helpful for me.
I have a question. In class LangevinDynamics(object):, you never run self.optim.zero_grad()
. Is this on purpose?
You use the preconditioned SGD in gaussian_LD.py demo. However, if you change pSGLD to SGLD, it actually doesn't work:
Thanks for the code! I have a question regarding the gradient's direction when sampling the next variable.
In class pSGLD(Optimizer)
, the mean is updated using a negative learning rate p.data.addcdiv_(grad, G, value=-group['lr'])
. However, when calculating the transition probability in def proposal_dist(self, idx: int) -> torch.Tensor
from class MetropolisAdjustedLangevin(object)
, I think the gradient direction needs to be reversed self.x[idx] - self.x[idx ^ 1] + self.lr_fn(self.counter) * self.grad[idx ^ 1]
instead ofself.x[idx] - self.x[idx ^ 1] - self.lr_fn(self.counter) * self.grad[idx ^ 1]
. Why is the gradient implemented in another direction?
Hi,
in line 105 of precondSGLD.py
, why are you dividing by G to obtain the noise_std
? Surely following the paper by Li et al. you should be multiplying by G? Or am I missing something? Because this line is causing my parameter estimates to explode ...
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.