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: add loop termination methods to VBMC #10

Closed Solosneros closed 3 years ago

Solosneros commented 3 years ago

I implemented and tested three private methods to VBMC that originate from vbmc_termination.m.

Furthermore, I added pytest-mock to the dependencies. It helps to test methods independent of other methods or components. See test_vbmc_is_finished_stability(mocker) in pyvbmc/vbmc/test_vbmc_loop_termination.py for an example on how this improves the testability of the _is_finished method without having to care about the _compute_reliability_index() method.

Solosneros commented 3 years ago

I modified pyvbmc so that the initial iteration is 0 (in MATLAB it is 1). Furthermore, I added an interim solution to store the reliability index and stableflag. This will be improved later with the new iteration_history object.