Any Thoughts on Sequential Bayesian Update

Hi,

I am working on using PyMC for (i) uncertainty quantification and (ii) sequential learning—a new data comes up sequentially.

For better uncertainty quantification, using all the previous data as a batch to train my model would be a good idea. But this is computationally heavy.

On the other hand, if I use a previous posterior as a new prior in each sequence, I lose the correlated information in posterior space, which is bad for uncertainty quantification.

At this moment, the uncertainty quantification piece is more important for me, so I’ve been using batch learning. I’ve been trying nuts, nuts-numpyro, and pathfinders to speed up the model training.

My question is:

  • Have you ever experienced a similar dilemma before? Then, how could you solve this?
  • Do you think there is a way to transport our prior to posterior seamlessly?

Thanks,

Jay

You can find some stuff in the discourse if you look. The “computational heavy” is very model dependent. Sometimes it’s trivially cheap(er) to just rerun the model with all the data.

You can also jump some hoops to avoid recompiling the functions, which could be the bottleneck.

There is a utility in pymc-extras that keeps a mv normal approximation of your old posterior, so it doesn’t lose (all sorts of) correlation: prior_from_idata — pymc_extras 0.10.1.dev10+gc247de42a documentation

Some models have conjugate priors or can be defined in terms of summary statistics where cost doesn’t grow with data

There’s definitely no single solution

1 Like

There’s also ADVI, which is a bit more amenable to online updating because it uses SGD/minibatches in the first place. You can save the state every “day” and then train it for some iterations on the day’s batch of new data for some iterations to get the new state.

There’s some half-hearted effort here to offer an ADVI implementation that is a bit more modular, splitting apart model, data, and optimization. If that’s something that would be helpful to you, collaborators are highly welcome :slight_smile:

1 Like