This repository is a comprehensive guide to mastering Bayesian Inference using Python. It transitions from the fundamental probability theory of Bayes' Theorem to advanced applications in Econometrics, Finance, and Machine Learning using modern probabilistic programming libraries like PyMC and ArviZ.
The repository is structured into 15 chapters, each providing theoretical context and runnable Python implementations.
- Chapter 1-3: Bayes' Theorem, Frequentist vs. Bayesian debates, and Conjugate Priors.
- Chapter 4-6: Bayesian Estimators, Credible Intervals, Loss Functions, and Hypothesis Testing.
- Chapter 7-8: Markov Chain Monte Carlo (MCMC) - from basic Metropolis-Hastings to advanced NUTS.
- Chapter 9: Variational Inference (ADVI) for high-dimensional scaling.
- Chapter 10-11: Linear/Logistic Regression and Hierarchical (Multilevel) Models.
- Chapter 12-14: Model Diagnostics, Model Averaging (BMA), and Sensitivity Analysis.
- Chapter 15: Deep Dive Applications:
- Econometrics: BVAR, Panel Data, and State-Space Models (Nile River flow).
- Finance: Portfolio Optimization and Bayesian Value-at-Risk (VaR).
- Machine Learning: Bayesian Neural Networks (BNN), Gaussian Processes, and LDA.
- Probabilistic Programming:
PyMC - Exploratory Analysis:
ArviZ - Data Science:
NumPy,Pandas,Matplotlib,Scikit-Learn
- Clone the Repository:
git clone https://github.com/Vipeen21/bayesian-statistics-python.git cd bayesian-statistics-python - Install Requirements:
pip install pymc arviz numpy pandas matplotlib scikit-learn
- Explore: Start with the
Introductionor jump directly into Chapter 15 to see Bayesian methods applied to real-world financial and economic data.
One of the highlights of this repo is the implementation of Bayesian Neural Networks (BNNs). Unlike standard NNs, a BNN provides a full distribution for its weights, allowing for Uncertainty Quantification in classification—visualized through decision boundaries where the model "knows what it doesn't know."
This project is licensed under the MIT License.
Created and maintained by Vipeen Kumar