Add AI-powered Bayesian inference (AI Priors/AI posterior) #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a Bayesian PPI variant AI-powered Bayesian inference via
ppi_py/ai_priors.py
. Exposes functionssample_ai_posterior
andcalibrate_dp_alpha_empirical_coverage_estimate
. Currently the calibration function is based on a coarse, low-fidelity grid search as high-fidelity calibration can be computationally intensive for this method.Something to note is that the implementation is general and the
sample_ai_posterior
requires users to specify aloss
function which isCallable
. For parallel computation on the CPU to work, the functionloss
must be pickleable (i.e. defined at the top-level of a module). To overcome this and allow for lambda functions/nested functions/etc may require an additional dependency likecloudpickle
.Adds tests via
tests/test_ai_priors.py
and an example notebook on the galaxies dataset viaexamples/galaxies_aip.ipynb
.Uses
examples/aip_utils.py
solely to add code to make a plot in the example notebook. Could be potentially refactored out, with the code moved to the notebook itself or the existing plotting function to be suitably modified.