# camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers architecture

> Architecture diagram of the GitHub repository camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers
- Repository: https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers

## Overview

This repository is an educational book and collection of runnable examples about Bayesian inference and probabilistic programming, not a single application. A reader follows chapter material from introductory models through MCMC, large-number reasoning, loss functions, and prior selection, with notebooks and supporting examples illustrating the ideas. The README documents those chapter topics; the source excerpts also show standalone modeling examples and small utilities, including a browser-based Bayesian bandit demonstration and competition metrics. Connections between chapter material and individual examples are not asserted where the excerpts do not show them.

Main entry points: [`Chapter1_Introduction`](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter1_Introduction) (Bayesian Introduction), [`Chapter2_MorePyMC`](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter2_MorePyMC) (Model Construction), [`Chapter3_MCMC`](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter3_MCMC) (MCMC Diagnostics), [`Chapter4_TheGreatestTheoremNeverTold`](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter4_TheGreatestTheoremNeverTold) (Large Numbers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["Bayesian Foundations"]
  node_intro["Bayesian Introduction"]
  node_modeling["Model Construction"]
end

subgraph group_inference["Inference Methods"]
  node_mcmc["MCMC Diagnostics"]
  node_large_numbers["Large Numbers"]
end

subgraph group_decision["Decision Applications"]
  node_loss["Loss Functions"]
  node_priors["Prior Selection"]
  node_bayesian_ml["Bayesian ML"]
end

subgraph group_examples["Runnable Examples"]
  node_chapter_examples["Chapter Examples"]
  node_bandit_demo["Bandit Demo<br/>[d3bandits.js]"]
end

subgraph group_utilities["Supporting Tools"]
  node_dark_worlds_metric["Dark Worlds Metric"]
  node_separation_plot["Separation Plot<br/>[separation_plot.py]"]
  node_auc["AUC Metric<br/>[auc.py]"]
end

node_reader(("Reader"))

node_reader -->|"reads first"| node_intro
node_reader -->|"studies modeling"| node_modeling
node_reader -->|"studies sampling"| node_mcmc
node_reader -->|"studies limits"| node_large_numbers
node_reader -->|"studies decisions"| node_loss
node_reader -->|"studies priors"| node_priors
node_reader -.->|"explores extension"| node_bayesian_ml

click node_intro "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter1_Introduction"
click node_modeling "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter2_MorePyMC"
click node_mcmc "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter3_MCMC"
click node_large_numbers "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter4_TheGreatestTheoremNeverTold"
click node_loss "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter5_LossFunctions"
click node_priors "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter6_Priorities"
click node_bayesian_ml "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter7_BayesianMachineLearning"
click node_chapter_examples "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/ExamplesFromChapters"
click node_bandit_demo "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter6_Priorities/d3bandits.js"
click node_dark_worlds_metric "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter5_LossFunctions/DarkWorldsMetric.py"
click node_separation_plot "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter2_MorePyMC/separation_plot.py"
click node_auc "https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter7_BayesianMachineLearning/auc.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_intro,node_modeling toneBlue
class node_mcmc,node_large_numbers toneAmber
class node_loss,node_priors,node_bayesian_ml toneMint
class node_chapter_examples,node_bandit_demo toneRose
class node_dark_worlds_metric,node_separation_plot,node_auc,node_reader toneIndigo
```

## Components

### Bayesian Foundations

- [Bayesian Introduction](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter1_Introduction): `Chapter1_Introduction`
- [Model Construction](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter2_MorePyMC): `Chapter2_MorePyMC`

### Inference Methods

- [MCMC Diagnostics](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter3_MCMC): `Chapter3_MCMC`
- [Large Numbers](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter4_TheGreatestTheoremNeverTold): `Chapter4_TheGreatestTheoremNeverTold`

### Decision Applications

- [Loss Functions](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter5_LossFunctions): `Chapter5_LossFunctions`
- [Prior Selection](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter6_Priorities): `Chapter6_Priorities`
- [Bayesian ML](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/Chapter7_BayesianMachineLearning): `Chapter7_BayesianMachineLearning`

### Runnable Examples

- [Chapter Examples](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/tree/master/ExamplesFromChapters): `ExamplesFromChapters`
- [Bandit Demo](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter6_Priorities/d3bandits.js): `Chapter6_Priorities/d3bandits.js`

### Supporting Tools

- [Dark Worlds Metric](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter5_LossFunctions/DarkWorldsMetric.py): `Chapter5_LossFunctions/DarkWorldsMetric.py`
- [Separation Plot](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter2_MorePyMC/separation_plot.py): `Chapter2_MorePyMC/separation_plot.py`
- [AUC Metric](https://github.com/camdavidsonpilon/probabilistic-programming-and-bayesian-methods-for-hackers/blob/master/Chapter7_BayesianMachineLearning/auc.py): `Chapter7_BayesianMachineLearning/auc.py`

### Other components

- **Reader**

## Connections

- Reader → Bayesian Introduction: reads first (evidence: `README.md`)
- Reader → Model Construction: studies modeling (evidence: `README.md`)
- Reader → MCMC Diagnostics: studies sampling (evidence: `README.md`)
- Reader → Large Numbers: studies limits (evidence: `README.md`)
- Reader → Loss Functions: studies decisions (evidence: `README.md`)
- Reader → Prior Selection: studies priors (evidence: `README.md`)
- Reader → Bayesian ML: explores extension
