1

I am doing Approximate Bayesian Computation with Sequential Monte Carlo with PyMC in a way that is similar to what is described in this example of the PyMC documentation. The motivation for choosing this approach is that I have a simulator method (as it is called in the the documentation) that is complicated and computationally very expensive to evaluate, and this is a setting for which this approach is well suited.

For the simplified form of the model, this works very well. However the full version of the simulator method takes very long to evaluate, on the order of ~1-10s. This makes the Sequential Monte Carlo prohibitively slow.

I already tried to tune the number of draws and epsilon in pymc.Simulator() to reduce the runtime while still giving a meaningful result, which already helped, but not enough. Naturally, I am also working on optimising the simulation function, however it is very likely impossible to reduce the runtime fundamentally.

What are approaches that I could try to deal with such an expensive simulation function? How could I optimise the number of times this simulation function needs to be called? Or is there an entirely different approach, which is better suited to this issue? (My apologies if I am missing something obvious, I am quite new to Bayesian inference.)

lm1909
  • 11
  • 3
  • Please consider upvoting and accepting the answer or, alternatively, describe why you think it is wrong or what is not clear from it. – noe Feb 24 '23 at 23:23

1 Answers1

1

Maybe you could try variational inference. Specifically Variational Sequential Monte Carlo. This would give you a much lighter computation, as it does not rely on sampling.

The authors of Variational Sequential Monte Carlo released their implementation here.

If you prefer to implement it yourself, I suggest using Automatic Differentiation Variational Inference (ADVI). Some frameworks that support ADVI in Python are PyMC itself, Pyro or STAN via CmdStanPy (PyStan does not support it)

noe
  • 22,074
  • 1
  • 43
  • 70
  • Thank you, this is very helpful! (will upvote as soon as I have enough reputation) I am currently working on trying this out - I think one issue might be that gradients are required for ADVI; I implemented this with a finite difference method, which however, is also quite expensive if the model function is expensive - I'll see whether I can make it work. – lm1909 Feb 26 '23 at 00:59