Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ interpret probabilistic models from first principles. It is the teaching compani
## Repository Structure

- `scripts/` — Runnable Python tutorial scripts:
- `chapter_1_introduction/` — Models, fitting data, non-linear searches, results and samples
- `chapter_2_scientific_workflow/` — Reserved stub for future material (empty except README)
- `chapter_1_introduction/` — Models, fitting data, non-linear searches, results and samples, and a prose-only scientific workflow closing tutorial
- `chapter_3_graphical_models/` — Individual / graphical / hierarchical models, Expectation Propagation
- `simulators/` — Simulator scripts that generate the tutorial 1D datasets at runtime
- `notebooks/` — Jupyter versions, generated from `scripts/` (do not edit directly)
Expand Down Expand Up @@ -65,6 +64,9 @@ The navigator catalogue — `llms-full.txt` + `workspace_index.json` — is what
gates; it is rebuilt by the same PyAutoHands generate/merge flow that builds the notebooks. Commit
regenerated notebooks and catalogue alongside the script changes.

`tutorial_6_scientific_workflow.py` is prose-only by design: its generated notebook must contain no
code cells, including Colab setup. Verify this after regeneration.

## Bulk-edit safety

When editing the same region across many scripts in one pass, only rewrite the targeted region.
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ they are concise, API-focused, and assume the concepts taught in **HowToFit** as
## Chapters

- `chapter_1_introduction` — Models, likelihoods, non-linear searches, why modeling is hard, and how to
interpret the results of a fit.
- `chapter_2_scientific_workflow` — Reserved for future material on building a full scientific
model-fitting workflow. Currently a stub; the corresponding overview lives in
`autofit_workspace/scripts/overview/overview_2_scientific_workflow.py`.
interpret the results of a fit, ending with a short guide to building a scientific workflow.
- `chapter_3_graphical_models` — Fitting many datasets simultaneously with graphical models,
hierarchical models, and Expectation Propagation.

Expand Down
2 changes: 2 additions & 0 deletions config/build/markdown_examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
max_minutes: 120
- script: scripts/chapter_1_introduction/tutorial_5_results_and_samples.py
max_minutes: 90
- script: scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py
max_minutes: 1
1 change: 1 addition & 0 deletions llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ AUTO-GENERATED by PyAutoHands — do not edit by hand; regenerate with generate.
- Contents: Data, Model, Analysis, Alternative Syntax, Collection, Search, Model Fit, Result, Why Modeling is Hard, Prior Tuning, Reducing Complexity, Search More Thoroughly, Summary, Run Times, Model Mismatch, Astronomy Example, Wrap Up
- [Tutorial 5: Results And Samples](scripts/chapter_1_introduction/tutorial_5_results_and_samples.py): In this tutorial, we'll cover all of the output that comes from a non-linear search's `Result` object.
- Contents: Data, Reused Functions, Model Fit, Result, Samples, Parameters, Figures of Merit, Instances, Vectors, Labels, Posterior / PDF, Plot, Errors, PDF, Other Results, Sample Instance, Bayesian Evidence, Derived Errors (PDF from samples), Samples Filtering, Latex
- [Tutorial 6: Scientific Workflow](scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py): You can now compose a model, fit it to data and interpret its results. A scientific study often repeats these steps for many datasets, competing models and different non-linear searches. The next challenge is keeping those fits organized so that you can understand and compare them.

## chapter_3_graphical_models

Expand Down
1 change: 1 addition & 0 deletions markdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ Every page below is the corresponding example script **fully executed**, rendere
- [Tutorial 3: Non Linear Search](chapter_1_introduction/tutorial_3_non_linear_search.md) — from `scripts/chapter_1_introduction/tutorial_3_non_linear_search.py`
- [Tutorial 4: Why Modeling Is Hard](chapter_1_introduction/tutorial_4_why_modeling_is_hard.md) — from `scripts/chapter_1_introduction/tutorial_4_why_modeling_is_hard.py`
- [Tutorial 5: Results And Samples](chapter_1_introduction/tutorial_5_results_and_samples.md) — from `scripts/chapter_1_introduction/tutorial_5_results_and_samples.py`
- [Tutorial 6: Scientific Workflow](chapter_1_introduction/tutorial_6_scientific_workflow.md) — from `scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py`

These pages are regenerated manually by PyAutoHands's `generate_markdown.py` when a curated script changes.
16 changes: 10 additions & 6 deletions markdown/chapter_1_introduction/start_here.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ data analysis.
The lectures use the probabilistic programming language PyAutoFit, an open-source library for model-fitting,
scientific analysis, and big data analysis (https://github.com/PyAutoLabs/PyAutoFit).

The HowToFit lectures are composed of 3 chapters:
The HowToFit lectures cover an introductory chapter and an advanced chapter:

**Chapter 1: Introduction**: How to fit a model to data, perform statistical inference, and interpret the results
for scientific analysis.

**Chapter 2: Scientific Workflow**: Scaling model-fitting to big datasets while ensuring detailed scientific analysis
of the results.
for scientific analysis, ending with an introduction to scientific workflows.

**Chapter 3: Graphical Models**: Simultaneous model fitting of large datasets, scaling up to models with tens of
thousands of parameters.
Expand All @@ -51,12 +48,19 @@ interpretation. The chapter includes:

`tutorial_5_results_and_samples.py`: Interpreting model-fit results and using the samples for scientific analysis.

`tutorial_6_scientific_workflow.py`: A short, prose-only introduction to organizing and comparing many model fits,
with links to the scientific workflow guide and workspace example.

An applied astronomy-focused example (previously tutorial 8) now lives in
`autofit_workspace_developer/scripts/howtofit/chapter_1_introduction/tutorial_8_astronomy_example.py`,
alongside the larger `projects/cosmology/` example. These depend on astronomy-specific datasets
alongside the larger `autofit_workspace_developer/projects/cosmology/` example. These depend on astronomy-specific datasets
that only live in the developer workspace.


```python

from autofit import setup_notebook; setup_notebook()

```

Working Directory has been set to `HowToFit`
30 changes: 30 additions & 0 deletions markdown/chapter_1_introduction/tutorial_6_scientific_workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
> ✏️ **This page is auto-generated from [`scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py`](../../scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py) — do not edit it directly.**
> It shows the example fully executed, with its real output images.
> Run it yourself via the [Python script](../../scripts/chapter_1_introduction/tutorial_6_scientific_workflow.py) or the [Jupyter notebook](../../notebooks/chapter_1_introduction/tutorial_6_scientific_workflow.ipynb).

Tutorial 6: Scientific Workflow
==============================

You can now compose a model, fit it to data and interpret its results. A scientific study often repeats
these steps for many datasets, competing models and different non-linear searches. The next challenge is
keeping those fits organized so that you can understand and compare them.

PyAutoFit saves each fit's model, search settings, samples and summaries alongside its visualizations.
These outputs let you revisit a fit without rerunning inference, record quantities specific to your
science, and trace a comparison back to its original results. Live progress and model-fit plots also
help you develop intuition for how inference is progressing while a search runs.

Imagine five datasets, each fitted with several models and searches. A scientific workflow makes that
collection navigable: you can inspect the folders yourself or ask an assistant to compare parameter
constraints, fit quality and runtime, and identify results that need closer attention. Model composition
provides the competing models; the workflow makes their results feasible to interpret together.

Continue with the [Scientific Workflow guide](https://pyautofit.readthedocs.io/en/latest/overview/scientific_workflow.html)
for natural language prompts that build this workflow with an assistant.

For the corresponding Python implementation, follow the
[workspace scientific workflow example](https://github.com/PyAutoLabs/autofit_workspace/blob/main/scripts/overview/overview_2_scientific_workflow.py).

__Wrap Up__

Apply the workflow to your own data before returning to chapter 3 for graphical and hierarchical models.
5 changes: 2 additions & 3 deletions notebooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ The `scripts` folder contains **HowToFit** lectures, which teach a new user how

# Folders

- `chapter_1_introduction`: Introduction lectures describing how to compose and fit models in **PyAutoFit**.
- `chapter_2_scientific_workflow`: Reserved stub for future material on building a full scientific model-fitting workflow. The equivalent overview currently lives in `autofit_workspace/scripts/overview/overview_2_scientific_workflow.py`.
- `chapter_1_introduction`: Introduction lectures describing how to compose and fit models in **PyAutoFit**, ending with a prose-only introduction to scientific workflows.
- `chapter_3_graphical_models`: How to compose and fit graphical models which fit many datasets simultaneously, including hierarchical models and Expectation Propagation.
- `simulators`: Simulator scripts that generate the tutorial 1D datasets at runtime.

Expand Down Expand Up @@ -34,7 +33,7 @@ is auto-formatted with `black` — see <https://github.com/python/black>.

# How to Approach HowToFit

**HowToFit** currently consists of three chapters (chapter 2 is a stub). Chapter 1 will take a couple of
**HowToFit** consists of the introductory chapter 1 and advanced chapter 3. Chapter 1 will take a couple of
hours to work through. The concepts in chapter 3 are challenging, and familiarity with **PyAutoFit** and
model fitting is desirable before tackling them.

Expand Down
2 changes: 2 additions & 0 deletions notebooks/chapter_1_introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ The chapter contains the following tutorials:
- [Tutorial 4: Why Modeling Is Hard](https://colab.research.google.com/github/PyAutoLabs/HowToFit/blob/2026.9.8.1/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb) — Why fitting complex models is challenging and how a good scientific approach overcomes common problems.

- [Tutorial 5: Results and Samples](https://colab.research.google.com/github/PyAutoLabs/HowToFit/blob/2026.9.8.1/notebooks/chapter_1_introduction/tutorial_5_results_and_samples.ipynb) — Interpreting model-fit results and using the samples for scientific analysis.

- [Tutorial 6: Scientific Workflow](../../notebooks/chapter_1_introduction/tutorial_6_scientific_workflow.ipynb) — A prose-only introduction to organizing and comparing many fits, with links to the full guide and workspace example.
10 changes: 5 additions & 5 deletions notebooks/chapter_1_introduction/start_here.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,10 @@
"The lectures use the probabilistic programming language PyAutoFit, an open-source library for model-fitting,\n",
"scientific analysis, and big data analysis (https://github.com/PyAutoLabs/PyAutoFit).\n",
"\n",
"The HowToFit lectures are composed of 3 chapters:\n",
"The HowToFit lectures cover an introductory chapter and an advanced chapter:\n",
"\n",
"**Chapter 1: Introduction**: How to fit a model to data, perform statistical inference, and interpret the results\n",
"for scientific analysis.\n",
"\n",
"**Chapter 2: Scientific Workflow**: Scaling model-fitting to big datasets while ensuring detailed scientific analysis\n",
"of the results.\n",
"for scientific analysis, ending with an introduction to scientific workflows.\n",
"\n",
"**Chapter 3: Graphical Models**: Simultaneous model fitting of large datasets, scaling up to models with tens of\n",
"thousands of parameters.\n",
Expand All @@ -53,6 +50,9 @@
"\n",
"`tutorial_5_results_and_samples.py`: Interpreting model-fit results and using the samples for scientific analysis.\n",
"\n",
"`tutorial_6_scientific_workflow.py`: A short, prose-only introduction to organizing and comparing many model fits,\n",
"with links to the scientific workflow guide and workspace example.\n",
"\n",
"An applied astronomy-focused example (previously tutorial 8) now lives in\n",
"`autofit_workspace_developer/scripts/howtofit/chapter_1_introduction/tutorial_8_astronomy_example.py`,\n",
"alongside the larger `autofit_workspace_developer/projects/cosmology/` example. These depend on astronomy-specific datasets\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Tutorial 6: Scientific Workflow\n",
"==============================\n",
"\n",
"You can now compose a model, fit it to data and interpret its results. A scientific study often repeats\n",
"these steps for many datasets, competing models and different non-linear searches. The next challenge is\n",
"keeping those fits organized so that you can understand and compare them.\n",
"\n",
"PyAutoFit saves each fit's model, search settings, samples and summaries alongside its visualizations.\n",
"These outputs let you revisit a fit without rerunning inference, record quantities specific to your\n",
"science, and trace a comparison back to its original results. Live progress and model-fit plots also\n",
"help you develop intuition for how inference is progressing while a search runs.\n",
"\n",
"Imagine five datasets, each fitted with several models and searches. A scientific workflow makes that\n",
"collection navigable: you can inspect the folders yourself or ask an assistant to compare parameter\n",
"constraints, fit quality and runtime, and identify results that need closer attention. Model composition\n",
"provides the competing models; the workflow makes their results feasible to interpret together.\n",
"\n",
"Continue with the [Scientific Workflow guide](https://pyautofit.readthedocs.io/en/latest/overview/scientific_workflow.html)\n",
"for natural language prompts that build this workflow with an assistant.\n",
"\n",
"For the corresponding Python implementation, follow the\n",
"[workspace scientific workflow example](https://github.com/PyAutoLabs/autofit_workspace/blob/main/scripts/overview/overview_2_scientific_workflow.py).\n",
"\n",
"__Wrap Up__\n",
"\n",
"Apply the workflow to your own data before returning to chapter 3 for graphical and hierarchical models."
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
10 changes: 0 additions & 10 deletions notebooks/chapter_2_scientific_workflow/README.md

This file was deleted.

5 changes: 2 additions & 3 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ The `scripts` folder contains **HowToFit** lectures, which teach a new user how

# Folders

- `chapter_1_introduction`: Introduction lectures describing how to compose and fit models in **PyAutoFit**.
- `chapter_2_scientific_workflow`: Reserved stub for future material on building a full scientific model-fitting workflow. The equivalent overview currently lives in `autofit_workspace/scripts/overview/overview_2_scientific_workflow.py`.
- `chapter_1_introduction`: Introduction lectures describing how to compose and fit models in **PyAutoFit**, ending with a prose-only introduction to scientific workflows.
- `chapter_3_graphical_models`: How to compose and fit graphical models which fit many datasets simultaneously, including hierarchical models and Expectation Propagation.
- `simulators`: Simulator scripts that generate the tutorial 1D datasets at runtime.

Expand Down Expand Up @@ -34,7 +33,7 @@ is auto-formatted with `black` — see <https://github.com/python/black>.

# How to Approach HowToFit

**HowToFit** currently consists of three chapters (chapter 2 is a stub). Chapter 1 will take a couple of
**HowToFit** consists of the introductory chapter 1 and advanced chapter 3. Chapter 1 will take a couple of
hours to work through. The concepts in chapter 3 are challenging, and familiarity with **PyAutoFit** and
model fitting is desirable before tackling them.

Expand Down
2 changes: 2 additions & 0 deletions scripts/chapter_1_introduction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ The chapter contains the following tutorials:
- [Tutorial 4: Why Modeling Is Hard](https://colab.research.google.com/github/PyAutoLabs/HowToFit/blob/2026.9.8.1/notebooks/chapter_1_introduction/tutorial_4_why_modeling_is_hard.ipynb) — Why fitting complex models is challenging and how a good scientific approach overcomes common problems.

- [Tutorial 5: Results and Samples](https://colab.research.google.com/github/PyAutoLabs/HowToFit/blob/2026.9.8.1/notebooks/chapter_1_introduction/tutorial_5_results_and_samples.ipynb) — Interpreting model-fit results and using the samples for scientific analysis.

- [Tutorial 6: Scientific Workflow](../../notebooks/chapter_1_introduction/tutorial_6_scientific_workflow.ipynb) — A prose-only introduction to organizing and comparing many fits, with links to the full guide and workspace example.
10 changes: 5 additions & 5 deletions scripts/chapter_1_introduction/start_here.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@
The lectures use the probabilistic programming language PyAutoFit, an open-source library for model-fitting,
scientific analysis, and big data analysis (https://github.com/PyAutoLabs/PyAutoFit).

The HowToFit lectures are composed of 3 chapters:
The HowToFit lectures cover an introductory chapter and an advanced chapter:

**Chapter 1: Introduction**: How to fit a model to data, perform statistical inference, and interpret the results
for scientific analysis.

**Chapter 2: Scientific Workflow**: Scaling model-fitting to big datasets while ensuring detailed scientific analysis
of the results.
for scientific analysis, ending with an introduction to scientific workflows.

**Chapter 3: Graphical Models**: Simultaneous model fitting of large datasets, scaling up to models with tens of
thousands of parameters.
Expand All @@ -48,6 +45,9 @@

`tutorial_5_results_and_samples.py`: Interpreting model-fit results and using the samples for scientific analysis.

`tutorial_6_scientific_workflow.py`: A short, prose-only introduction to organizing and comparing many model fits,
with links to the scientific workflow guide and workspace example.

An applied astronomy-focused example (previously tutorial 8) now lives in
`autofit_workspace_developer/scripts/howtofit/chapter_1_introduction/tutorial_8_astronomy_example.py`,
alongside the larger `autofit_workspace_developer/projects/cosmology/` example. These depend on astronomy-specific datasets
Expand Down
Loading
Loading