# BayesianDecisionAnalysis

Repository for a workshop on Bayesian Decision Analysis

View the Project on GitHub AllenDowney/BayesianDecisionAnalysis

## PyData Global

This repository contains slides and Jupyter notebooks for a tutorial on Bayesian Decision Analysis. Most recently I presented it at PyData Global 2022.

Abstract

This tutorial is a hands-on introduction to Bayesian Decision Analysis (BDA), which is a framework for using probability to guide decision-making under uncertainty. I start with Bayes’s Theorem, which is the foundation of Bayesian statistics, and work toward the Bayesian bandit strategy, which is used for A/B testing, medical tests, and related applications. For each step, I provide a Jupyter notebook where you can run Python code and work on exercises. In addition to the bandit strategy, I summarize two other applications of BDA, optimal bidding and deriving a decision rule. Finally, I suggest resources you can use to learn more.

The examples in this tutorial are from Think Bayes.

Outline

• Problem statement: A/B testing, medical tests, and the Bayesian bandit problem
• Prerequisites and goals
• Bayes’s theorem and the five urn problem
• Using Pandas to represent a PMF
• Estimating proportions
• From belief to strategy
• Implementing and testing Thompson sampling
• More generally: two other examples of BDA
• Resources and next steps

Prerequisites

For this tutorial, you should be familiar with Python at an intermediate level. We’ll use NumPy, SciPy, and Pandas, but I’ll explain what you need to know as we go. You should be familiar with basic probability, but you don’t need to know anything about Bayesian statistics. I provide Jupyter notebooks that run on Colab, so you don’t have to install anything or prepare ahead of time. But you should be familiar with Jupyter notebooks.

## Previous versions

For the extended version of the workshop, here are the slides.

For each of the notebooks below, you have two options: if you view the notebook on NBViewer, you can read it, but you can’t run the code. If you run the notebook on Colab, you’ll be able to run the code, do the exercises, and save your modified version of the notebook in a Google Drive (if you have one).

Then take this quiz

### 02_pmf

Then take this quiz

### 03_euro

Then take this quiz

### 04_bandit

Then take this quiz