edward icon indicating copy to clipboard operation
edward copied to clipboard

importance sampling and sequential monte carlo

Open dustinvtran opened this issue 8 years ago • 4 comments

dustinvtran avatar Oct 01 '16 05:10 dustinvtran

Hi @dustinvtran, I've been going through the codebase to figure out how to best implement SMC, and was looking for a little validation. Would subclassing from MonteCarlo and drawing inspiration from the Metropolis-Hastings implementation be the right way to go about it?

faezs avatar Mar 29 '17 01:03 faezs

Yep, I think that makes sense. The simplest version to get started would follow Metropolis-Hastings' build_update() but without the Metropolis correction. This would implement vanilla importance sampling.

dustinvtran avatar Mar 29 '17 13:03 dustinvtran

Hi, I'm working on an implementation of IS (a first step before SMC) and I was thinking of the two following options:

  1. Implement an ImportanceSampling class inheriting from MonteCarlo. The build_update() method would simply compute one sample from the prior and its the importance weight (likelihood ratio). Each iteration would store its result internally and only in populate the user's Empirical in the finalize() method by sampling the auto-normalized weighted approximation.

  2. Implement a WeightedEmpirical distribution, make Empirical inherit from it (with default weights of 1/N) and replace in MonteCarlo the Empirical requirement by WeightedEmpirical. Then at each iteration directly populate the user's WeightedEmpirical and auto-normalize the distribution in the finalize() method.

Which of these two options do you think make more sense? Or would you have any other suggestions / comments?

matthieubulte avatar Aug 19 '18 13:08 matthieubulte

I'm not a contributor, so take this with a grain of salt, but a WeightedEmpirical distribution makes more sense to me than keeping the weights internal to ImportanceSampling. It's convenient to be able to access the underlying samples & weights for approximating integrals without experiencing another round of sampling error.

EvanKrall avatar Aug 24 '18 23:08 EvanKrall