Add a set_priors_to_posteriors (or perhaps something more elegant... bayesian_update? Just update?) method to pf.models.Model which sets the prior distributions to the current value of the posterior distributions, to allow Bayesian updating / streaming inference / incremental updates.
Should be relatively straightforward I think. :thinking: Can't just do for p in self.parameters: p.prior = p.posterior since that would set it by reference, but will need to make a copy of each parameter's posterior Distribution object and fix the underlying variables at their current values (get constants from variables), then set the prior to that. Maybe add a bayesian_udpate() method to Parameter which does that, then Module's bayesian_update() can just be for p in self.parameters: p.bayesian_update()
Add a
set_priors_to_posteriors
(or perhaps something more elegant...bayesian_update
? Justupdate
?) method topf.models.Model
which sets the prior distributions to the current value of the posterior distributions, to allow Bayesian updating / streaming inference / incremental updates.Should be relatively straightforward I think. :thinking: Can't just do
for p in self.parameters: p.prior = p.posterior
since that would set it by reference, but will need to make a copy of each parameter's posterior Distribution object and fix the underlying variables at their current values (get constants from variables), then set the prior to that. Maybe add abayesian_udpate()
method to Parameter which does that, then Module'sbayesian_update()
can just befor p in self.parameters: p.bayesian_update()