Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ page first draft #657

Merged
merged 8 commits into from
Apr 18, 2023
85 changes: 75 additions & 10 deletions docs/faq.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,93 @@
Frequently Asked Questions
**************************

Installation issues
General Questions
===================

Bambi not working on Windows
Why have a Bayesian regression library?
----------------------------

If Bambi does not work on Windows you can...
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.

* First
* Second

And finally, see `this issue <https://github.com/bambinos/bambi/issues/389>`_.
abuzarmahmood marked this conversation as resolved.
Show resolved Hide resolved


Bambi not working on Linux
I'm not familiar with Bayesian modelling, where can I learn more?
----------------------------

* First
* Second
There are a number of excellent resources available online, including:
* [Bambi examples](https://bambinos.github.io/bambi/examples.html)
* [Bayesian Modeling and Computation](https://www.amazon.com/Bayesian-Modeling-Computation-Statistics-Science/dp/0124058884)
abuzarmahmood marked this conversation as resolved.
Show resolved Hide resolved
* [Bayesian Data Analysis](https://www.amazon.com/Bayesian-Analysis-Chapman-Statistical-Science/dp/1439840954)
* [Bayesian Methods for Hackers](https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers)

What is the difference between Bambi and PyMC3?
abuzarmahmood marked this conversation as resolved.
Show resolved Hide resolved
----------------------------
* Bambi is a wrapper around PyMC3, NumPyro, and BlackJax. It provides a simple interface for
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say Bambi is a library built on top of PyMC, it's not a wrapper of PyMC. Also, it's not a wrapper of NumPyro or BlackJax. Technically when PyMC compiles a PyMC model for sampling with NumPyro or Blackjax it's creating such models, but it's happening all automatically and it's not exposed to users

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, calling it a wrapper is incorrect. Thank you for the correction. I also took out mention of numpyro and blackjax here because they are mentioned as backends in multiple other questions.

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.


Miscellaneous how to
Inference Questions
====================

Pass arguments to ``Model.fit()``...
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](https://bambinos.github.io/bambi/api_reference.html)).

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?
abuzarmahmood marked this conversation as resolved.
Show resolved Hide resolved
----------------------------
Yes, Bambi supports inference on GPUs and TPUs using the numpyro and blackjax backends.
See the API for "fit" method for more details
[here](https://bambinos.github.io/bambi/api_reference.html).

Model Specification Questions
====================

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](https://bambinos.github.io/bambi/examples.html).

How do I find out what priors are available?
----------------------------
You can find a list of available priors in the [Bambi Models API](https://bambinos.github.io/bambi/api_reference.html#module-bambi.models) under the "family" argument.
abuzarmahmood marked this conversation as resolved.
Show resolved Hide resolved

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](https://bambinos.github.io/bambi/examples.html).