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_posteriorandcalibrate_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_posteriorrequires users to specify alossfunction which isCallable. For parallel computation on the CPU to work, the functionlossmust 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.pyand an example notebook on the galaxies dataset viaexamples/galaxies_aip.ipynb.Uses
examples/aip_utils.pysolely 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.