bambi icon indicating copy to clipboard operation
bambi copied to clipboard

Bambi FAQ could be more helpful

Open canyon289 opened this issue 3 years ago • 9 comments

  1. Remove boilerplate text
  2. Add actual FAQs

https://bambinos.github.io/bambi/faq.html image

canyon289 avatar Feb 19 '23 23:02 canyon289

This was created because someone once offered to write content for the FAQ, but that never happened. And we never wrote it either. We could remove it if there's nobody who can write it

tomicapretto avatar Feb 20 '23 14:02 tomicapretto

I'd be happy to contribute if I can get some pointers on what to include @tomicapretto @canyon289

abuzarmahmood avatar Mar 09 '23 21:03 abuzarmahmood

I would like to contribute .

please provide some information.

YuvrajSinghJadon avatar Mar 22 '23 13:03 YuvrajSinghJadon

@abuzarmahmood and @YuvrajSinghJadon youre both welcome to work on this. My suggeestion is come up with a question or two you think users will have, then add those explanations to the FAQ. Tomas or I can comment on the PR :)

canyon289 avatar Mar 22 '23 18:03 canyon289

Thanks @abuzarmahmood and @YuvrajSinghJadon for the initiative! And thanks Ravin for answering! Following Ravin's comment, I think you could start with a list of questions that you have about the project (how to do X, or is Y supported, or I have Z problem what does it mean?) and we can help with the answers to those questions, while you create the appropriate markdown/notebook file in a PR.

tomicapretto avatar Mar 22 '23 20:03 tomicapretto

Thank you for the pointers @tomicapretto and @canyon289. I've copied below a starter list of Q&A for your feedback. Full disclosure, I have only very recently started using Bambi so I apologize for inaccuracy/naivete in this list.

General

  • Why have a Bayesian regression library?

    • Bayesian modelling allows flexible (read 'bespoke') model specification and also provides an estimation of uncertainty in the model parameters. Both of these are wildly useful in practice, in particular in a business context where the model is used to make decisions, and where a complex model may be needed to capture the underlying relationships. Further, Bayesian modelling allows graceful handling of small sample sizes by judicious use of prior distributions.
  • I'm not familiar with Bayesian modelling, where can I learn more?

  • What is the difference between Bambi and PyMC3?

    • Bambi is a wrapper around PyMC3, NumPyro, and BlackJax. It provides a simple interface for specifying Bayesian models, and allows for easy inference using MCMC or variational inference.
    • PyMC3 is a library for Bayesian modelling, and is the backend used by Bambi. It is a very powerful library, but can be difficult to use for beginners. Bambi provides a simple interface for specifying models, and allows for easy inference using MCMC or variational inference.

Inference

  • My sampler through errors/indicating divergences, what should I do?

    • Divergences are a common issue in Bayesian modelling, and are usually not a problem as long as they are not prevalent. However, if you are seeing a lot of divergences, you may want to try 1) respecifying your model, 2) a different sampler.
    • If the sampler fails, this is likely an issue with model specification. Make sure you are using the correct priors for your model, and that you are not specifying a prior that is too strong (e.g. a prior that is too narrow), or one that does not match the data (e.g. a prior that doesn't cover the domain of the data such as using a HalfNormal prior for a parameter that can be negative).
  • What sampling methods are available?

    • The sampler used is automatically selected given the type of variables used in the model. For inference, Bambi supports both MCMC and variational inference. MCMC is the default, but you can specify variational inference by passing inference_method='vi' to Model.fit(). Bambi also supports multiple backends for MCMC, including NumPyro, and BlackJax (see API for "fit" method for more details here).
  • My sampler is taking a long time, what should I do?

    • Long sampling times may simply be a result of the model being complex, or the data being large. If you are using a sampler that supports parallelization, you can try increasing the number of chains and/or cores. If you are using a sampler that does not support parallelization, you can try using a different sampler that does (e.g. NumPyro vs. PyMC3). You can also use variational inference, which is much faster than MCMC, but is not as flexible. You can also try respecifying your model, or using a different prior.
  • Can infernece in Bambi be sped up using GPUs/TPUs?

    • Yes, Bambi supports inference on GPUs and TPUs using the numpyro and blackjax backends. See the API for "fit" method for more details here.

Model specification

  • My data has a non-normal distributions, can I still use Bambi?

    • Yes, Bambi supports a wide range of distributions which can be specified using the "family" argument to the "Model". You can find examples of how to specify these distributions in the Bambi examples.
  • How do I find out what priors are available?

    • You can find a list of available priors in the Bambi Models API under the "family" argument.
  • Does bambi come with pre-specified regression models?

    • To allow building of bespoke models, Bambi does not come with pre-specified regression models. However, you can find examples of how to specify models in the Bambi examples.

abuzarmahmood avatar Mar 23 '23 15:03 abuzarmahmood

This looks great. I have some comments but itll be easier to address those in a pull request. Mind opening one of those and we can keep the discussion going there?

canyon289 avatar Mar 23 '23 15:03 canyon289