# allendowney/thinkbayes2 architecture

> Architecture diagram of the GitHub repository allendowney/thinkbayes2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allendowney/thinkbayes2
- Repository: https://github.com/allendowney/thinkbayes2

## Overview

Think Bayes 2 is a free, computational introduction to Bayesian statistics. Its documented user workflow is to read a chapter and run its Jupyter notebook examples and exercises; exercise solutions are a separate capability. The visible tree contains analysis scripts and supporting utilities, but not the chapter notebooks or the core Bayesian library, so the graph shows representative analyses rather than claiming a complete execution pipeline. Relationships between analyses and their outputs are omitted where the excerpts do not establish them.

Main entry points: [`book/Filist.py`](https://github.com/allendowney/thinkbayes2/blob/master/book/Filist.py) (File text utility), [`scripts/effect_soln.py`](https://github.com/allendowney/thinkbayes2/blob/master/scripts/effect_soln.py) (Effect solution), [`scripts/hockey.py`](https://github.com/allendowney/thinkbayes2/blob/master/scripts/hockey.py) (Hockey analysis), [`scripts/train3.py`](https://github.com/allendowney/thinkbayes2/blob/master/scripts/train3.py) (Train example)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Book and learning"]
  node_chapter_notebooks["Chapter notebooks"]
  node_exercise_solutions["Exercise solutions"]
end

subgraph group_analysis["Bayesian examples"]
  node_brfss_analysis["BRFSS analysis<br/>[brfss.py]"]
  node_variability_analysis["Height variability<br/>[variability.py]"]
  node_effect_solution["Effect solution<br/>[effect_soln.py]"]
  node_hockey_analysis["Hockey analysis<br/>[hockey.py]"]
  node_dice_analysis["Dice example<br/>[dice.py]"]
  node_train_analysis["Train example<br/>[train3.py]"]
end

subgraph group_support["Supporting utilities"]
  node_column_reader["CSV row reader<br/>[columns.py]"]
  node_filist["File text utility<br/>[Filist.py]"]
  node_book_preprocess["Book preprocessing<br/>[preprocess.py]"]
  node_book_postprocess["Book postprocessing<br/>[postprocess.py]"]
  node_notebook_prep["Notebook preparation<br/>[prep_notebooks.py]"]
  node_notebook_tools["Notebook editing tools<br/>[jntools.py]"]
  node_solution_scrubber["Solution scrubbing<br/>[scrub_code.py]"]
end

node_reader(("Reader / learner"))

node_reader -->|"reads and runs"| node_chapter_notebooks
node_reader -->|"consults"| node_exercise_solutions
node_effect_solution -->|"imports"| node_variability_analysis
node_hockey_analysis -->|"reads CSV"| node_column_reader
node_train_analysis -->|"imports"| node_dice_analysis
node_book_preprocess -->|"uses"| node_filist
node_book_postprocess -->|"uses"| node_filist

click node_brfss_analysis "https://github.com/allendowney/thinkbayes2/blob/master/scripts/brfss.py"
click node_variability_analysis "https://github.com/allendowney/thinkbayes2/blob/master/scripts/variability.py"
click node_effect_solution "https://github.com/allendowney/thinkbayes2/blob/master/scripts/effect_soln.py"
click node_hockey_analysis "https://github.com/allendowney/thinkbayes2/blob/master/scripts/hockey.py"
click node_column_reader "https://github.com/allendowney/thinkbayes2/blob/master/scripts/columns.py"
click node_dice_analysis "https://github.com/allendowney/thinkbayes2/blob/master/scripts/dice.py"
click node_train_analysis "https://github.com/allendowney/thinkbayes2/blob/master/scripts/train3.py"
click node_filist "https://github.com/allendowney/thinkbayes2/blob/master/book/Filist.py"
click node_book_preprocess "https://github.com/allendowney/thinkbayes2/blob/master/book/preprocess.py"
click node_book_postprocess "https://github.com/allendowney/thinkbayes2/blob/master/book/postprocess.py"
click node_notebook_prep "https://github.com/allendowney/thinkbayes2/blob/master/jb/prep_notebooks.py"
click node_notebook_tools "https://github.com/allendowney/thinkbayes2/blob/master/jntools.py"
click node_solution_scrubber "https://github.com/allendowney/thinkbayes2/blob/master/soln/scrub_code.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_chapter_notebooks,node_exercise_solutions toneBlue
class node_brfss_analysis,node_variability_analysis,node_effect_solution,node_hockey_analysis,node_dice_analysis,node_train_analysis toneAmber
class node_column_reader,node_filist,node_book_preprocess,node_book_postprocess,node_notebook_prep,node_notebook_tools,node_solution_scrubber toneMint
class node_reader toneIndigo
```

## Components

### Book and learning

- **Chapter notebooks**
- **Exercise solutions**

### Bayesian examples

- [BRFSS analysis](https://github.com/allendowney/thinkbayes2/blob/master/scripts/brfss.py): `scripts/brfss.py`
- [Height variability](https://github.com/allendowney/thinkbayes2/blob/master/scripts/variability.py): `scripts/variability.py`
- [Effect solution](https://github.com/allendowney/thinkbayes2/blob/master/scripts/effect_soln.py): `scripts/effect_soln.py`
- [Hockey analysis](https://github.com/allendowney/thinkbayes2/blob/master/scripts/hockey.py): `scripts/hockey.py`
- [Dice example](https://github.com/allendowney/thinkbayes2/blob/master/scripts/dice.py): `scripts/dice.py`
- [Train example](https://github.com/allendowney/thinkbayes2/blob/master/scripts/train3.py): `scripts/train3.py`

### Supporting utilities

- [CSV row reader](https://github.com/allendowney/thinkbayes2/blob/master/scripts/columns.py): `scripts/columns.py`
- [File text utility](https://github.com/allendowney/thinkbayes2/blob/master/book/Filist.py): `book/Filist.py`
- [Book preprocessing](https://github.com/allendowney/thinkbayes2/blob/master/book/preprocess.py): `book/preprocess.py`
- [Book postprocessing](https://github.com/allendowney/thinkbayes2/blob/master/book/postprocess.py): `book/postprocess.py`
- [Notebook preparation](https://github.com/allendowney/thinkbayes2/blob/master/jb/prep_notebooks.py): `jb/prep_notebooks.py`
- [Notebook editing tools](https://github.com/allendowney/thinkbayes2/blob/master/jntools.py): `jntools.py`
- [Solution scrubbing](https://github.com/allendowney/thinkbayes2/blob/master/soln/scrub_code.py): `soln/scrub_code.py`

### Other components

- **Reader / learner**

## Connections

- Reader / learner → Chapter notebooks: reads and runs
- Reader / learner → Exercise solutions: consults
- Effect solution → Height variability: imports (evidence: `scripts/effect_soln.py`)
- Hockey analysis → CSV row reader: reads CSV (evidence: `scripts/hockey.py`)
- Train example → Dice example: imports (evidence: `scripts/train3.py`)
- Book preprocessing → File text utility: uses (evidence: `book/preprocess.py`)
- Book postprocessing → File text utility: uses (evidence: `book/postprocess.py`)
