BAMresearch / bayem

Implementation and derivation of "Variational Bayesian inference for a nonlinear forward model." [Chappell et al. 2008] for arbitrary, user-defined model errors.
MIT License
2 stars 1 forks source link

Json serialize #34

Closed TTitscher closed 3 years ago

TTitscher commented 3 years ago

By default, bayes.vb.MVN and bayes.vb.Gamma are not serializable with JSON. This PR provides a matching encoder and decoder to enable this.

IMO this is very handy when you want to easily read and write intermediate results to disk, e.g. in a pydoit-workflow where the posterior from one experiment is the prior of a subsequent one.

TTitscher commented 3 years ago

If that is too specific, let me know. This BayesEncoder and bayes_hook can easily moved somewhere else, e.g. to my examples, if I am the only one to use it.