Week 8,9 & 10 - GSOC 2024

Rohan BabbarRohan Babbar
2 min read

This blog post covers my contributions to the project "Prior Elicitation (PreliZ)" with ArviZ during the eighth, ninth, and tenth weeks of GSoC 2024.

Work Done

  1. Fix issues in distributions where r_v.owner.op.name = None for PyMC distributions.

  2. Add Bambi support for posterior_to_prior.

  3. Provide examples for posterior_to_prior using both Bambi and PyMC.

  4. Include documentation for Conda installation.

Bug Fix for Missing Owner Operator Name

Some distributions, like HalfStudentT, have r_v.owner.op.name set to None, which needed to be addressed since PreliZ also supports these distributions.

Bambi support for posterior_to_prior

Similar to the way we implemented PyMC support for posterior_to_prior, Bambi has been introduced to extend support to Bambi models. Since Bambi models have their backend model as PyMC, you can convert a Bambi model to PyMC using the following:

# bambi model
def get_bmb_model_information(model):
    if not model.built:
        model.build()
    pymc_model = model.backend.model
    return get_model_information(pymc_model)

So, extending support for Bambi distributions was much more straightforward and easier to implement.

Examples of posterior to prior (p2p)

Examples have been created for both PyMC and Bambi models to help illustrate how the posterior_to_prior method works. These examples are presented in a tab layout format for easier understanding. You can view the examples here.

Docs for Conda installation

Great New!! PreliZ is now available on Conda.

You can install it using the following command:

conda install -c conda-forge preliz

Conclusion

It has been an incredible summer with ArviZ. I have learned a lot about priors, Bayesian modeling, and new libraries such as PyMC and Bambi. PreliZ is a great library for collaboration, and I am eager to contribute and write more.

0
Subscribe to my newsletter

Read articles from Rohan Babbar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rohan Babbar
Rohan Babbar