acerbilab / pyvbmc

PyVBMC: Variational Bayesian Monte Carlo algorithm for posterior and model inference in Python
https://acerbilab.github.io/pyvbmc/
BSD 3-Clause "New" or "Revised" License
114 stars 6 forks source link

feat: save stats to IterationHistory #12

Closed Solosneros closed 3 years ago

Solosneros commented 3 years ago

I added IterationHistory which is a extended dict that can be used to record the statistics of VBMC. The general logic (which might have been occasionally violated in MATLAB) is that optimState (now vbmc object) would store the current value in the iteration, and stats (now IterationHistory) would record the history per iteration.

The main differences to a normal dict are:

Please note that some implementation and documentation depends on the further implementation of VBMC and other objects and must be enhanced in a later commit.

Test-coverage of IterationHistory: 100%, I think I tested every major case.

Solosneros commented 3 years ago

@lacerbi Please merge the #10 before this one. I might have to merge the main branch into this one afterwards. :) (There are a few overlaps between #12 and #10)

Solosneros commented 3 years ago

Record iteration from dict instead of many single parameters and improve robustness by checking for the existence of keys that must be specified on initialization of the object.