Chapter 13
Small Numerical Experiments
Experiment scripts, inputs and outputs, noisy linear data, fitting by search, plotting, saving summaries, and reading code as a report.
What this chapter does
This capstone chapter brings Python, NumPy, plotting, and reproducibility together in one small noisy-line experiment.
Lessons
Read these in order.
The chapter opening gives the main idea. Move through these lessons next; each page reuses ideas from the pages before it.
- 01Experiment as a Script
Organizing configuration, data, computation, plot, and summary into a readable workflow.
- 02Inputs, Outputs, and Checks
Naming experiment inputs and outputs, then guarding assumptions with small assertions.
- 03Noisy Linear Data
Creating synthetic linear data with repeatable random noise.
- 04Fitting a Line by Search
Searching candidate slopes with mean squared error before introducing richer fitting methods.
- 05Plotting the Result
Plotting noisy data and a fitted line before trusting a numerical result.
- 06Saving a Summary
Recording seed, settings, fitted values, loss, and an observation.
- 07Reading Code as a Report
Writing experiment code whose structure explains what was fixed, varied, measured, and observed.
You are ready when
- Organize an experiment as a script.
- Name inputs, outputs, and checks.
- Create repeatable noisy linear data.
- Fit a simple line by search.
- Plot data and fitted result.
- Save a short experiment summary.
- Read experiment code as a report.
Where this leads
- Mathematics
- Deep Learning
- Language Modeling