Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
c261d05
Add three batch case studies to the Applications chapter
claude Sep 3, 2026
6dff3de
Replace the SPE plots with Hotelling's T2 against SPE
claude Sep 5, 2026
b7577e8
Draw batch 54 in the highlight colour in the DuPont overlay
claude Sep 5, 2026
03f85d7
Show the DuPont cluster against the model centre, and a pass of revie…
claude Sep 5, 2026
789e141
Align the batch case studies with the Wold et al. chapter
claude Sep 5, 2026
99092d3
Trim the batch 49 paragraph, which now repeats the Wold comparison
claude Sep 5, 2026
5cb155c
Stop the SBR page asserting a thermal mechanism it cannot support
claude Sep 5, 2026
6bc726f
Explain the moving-sum trick, and plot signed z in the departure figure
claude Sep 5, 2026
bf928cf
Predict the SBR quality mid-batch and monitor the two faults on-line
claude Sep 5, 2026
61a5dc0
Draw the robust and the standard-deviation departure in one chart
claude Sep 5, 2026
5cf4b9e
Verify the DuPont final model against the batches left out of it
claude Sep 6, 2026
fa7dc74
Drop the mentions of the course notes and the aside on other score es…
claude Sep 6, 2026
ee2a2b1
Merge main: the executable-book check (#274)
claude Sep 6, 2026
db481bd
SBR: shorten the mid-batch prediction section to bullets, RMSEP only
claude Sep 6, 2026
a154d51
DuPont: draw the contribution direction on the model B score plot
claude Sep 6, 2026
3f7d770
DuPont: merge the raw trajectories into the group contribution figure
claude Sep 6, 2026
37fc1dd
SBR: say when each attribute becomes predictable, and the averaged error
claude Sep 6, 2026
ce186ff
SBR: batch 4 named on the score plot; the prediction band is one erro…
claude Sep 6, 2026
3d18ad8
SBR: explain why the T2 limit can stay constant, with a figure of the…
claude Sep 6, 2026
b5a19f7
Editorial pass on the DuPont and SBR pages; record the writing rules …
claude Sep 6, 2026
1bb9e43
SBR: a fault present at the start of the batch
claude Sep 6, 2026
8fd55ef
SBR: motivate the mid-batch prediction
claude Sep 6, 2026
01cb942
FMC: the disposition classes, not the identifiers, play no part in th…
claude Sep 6, 2026
8aa23b9
SBR: the false-alarm rate of the run rule, as a chain of bullets
claude Sep 6, 2026
e5edce4
Reread of the DuPont and SBR pages against the writing rules
claude Sep 6, 2026
4ebc03e
SBR: the forecast figure and its code in z form
claude Sep 6, 2026
dc0c79f
SBR: forecast legends read "from sample N onwards"; the later forecas…
claude Sep 6, 2026
8f6cb1a
SBR: the later forecast in dark blue
claude Sep 6, 2026
030bfc2
SBR: tie each forecast to the observed value at the sample it is made…
claude Sep 6, 2026
9c304b6
Align the three batch pages with the Garcia-Munoz thesis
claude Sep 6, 2026
2f2df01
FMC case study: clock time in every batch model, and the block scores…
claude Sep 6, 2026
1dfc4e2
Align the SBR and DuPont case studies with the Nomikos and MacGregor …
claude Sep 6, 2026
a3bfbe6
FMC case: score plots coded by disposition, batch 20's block scores a…
claude Sep 6, 2026
87594f3
FMC case: larger disposition markers and a fainter R2 line in the Plo…
claude Sep 6, 2026
a2d5f55
FMC case: phase-separator lines on the raw overlays and the per-sampl…
claude Sep 6, 2026
4e86b20
Batch case studies: reference links point at literature.learnche.org
claude Sep 6, 2026
6cdfc76
FMC case: list the ladder of models as bullets
claude Sep 6, 2026
3eb3f80
Batch case studies: five links into the process-improve repository
claude Sep 6, 2026
73e46a8
FMC case: gold for the high-solvent class, smaller squares, the model…
claude Sep 6, 2026
84c1bcb
FMC case: shorten the alignment paragraph and split it in two
claude Sep 6, 2026
5dfe970
FMC case: halve the data section and break it into short paragraphs
claude Sep 6, 2026
bf2d074
FMC case: tighten the data section to half its original length
claude Sep 6, 2026
42f213b
FMC case: the multiblock PLS figure as 2 x 3, block weights under eac…
claude Sep 6, 2026
e73bbeb
FMC case: drop the sentence on re-attaching the column index after sc…
claude Sep 6, 2026
71aa814
FMC case: weight-plot markers at the score plots' size
claude Sep 6, 2026
75f966d
FMC case: the loading caption describes, the paragraph after it inter…
claude Sep 6, 2026
1f0ab08
Batch case studies: PLS score-plot axes say R2X, the batch-PLS R2X is…
claude Sep 6, 2026
b448342
FMC case: a table comparing every model of the ladder, and the on-lin…
claude Sep 6, 2026
1f14b71
FMC case: shorten the reading of the four batches and put its conclus…
claude Sep 6, 2026
03c37e5
FMC case: cut the reading of the four batches by a quarter
claude Sep 6, 2026
4af6b50
Batch case studies: cross-links between the three pages, final polish
claude Sep 6, 2026
199c31b
CI: give the pyoptex chapter job the batch extra it now needs
claude Sep 6, 2026
4c4d7af
Cross-validation page: refresh the LDPE Q2 numbers the library now pr…
claude Sep 6, 2026
57c0adb
SBR case: name batch 34's fault timing in the raw-trajectory caption
claude Sep 7, 2026
2c38430
Batch readings: the missing-data papers, the FMC source, and two checks
claude Sep 7, 2026
88ea685
SBR case: the score plot's marker area is the batch's SPE
claude Sep 7, 2026
09dc0ed
SBR case: break the departure diagnostic out of one block of text
claude Sep 7, 2026
9bcc3b7
SBR case: squared residual on the marker area, and which chart speaks…
claude Sep 7, 2026
63fa03d
SBR case: the fit error and the prediction error, both on the parity …
claude Sep 7, 2026
a33177d
SBR case: a band of two prediction errors around the parity line
claude Sep 7, 2026
c8108ce
Citation: today's date, for the edits made since the last bump
claude Sep 7, 2026
2df0c4e
Batch cases: T squared is set as maths everywhere in the prose
claude Sep 7, 2026
09bdc1d
DuPont case: say what the two points of a contribution can be
claude Sep 7, 2026
3834e95
DuPont case: name all three kinds of point a contribution can use
claude Sep 7, 2026
b6ba3c7
DuPont case: the second group reads the same in every figure
claude Sep 7, 2026
00f63fe
DuPont case: one meaning per colour in the model C figure
claude Sep 7, 2026
3847e4c
Merge remote-tracking branch 'origin/main' into claude/issues-154-156…
claude Sep 7, 2026
3d4c64d
Make the per-chapter code checks as strict as the full one
claude Sep 7, 2026
e3da19a
SBR case: say what the twenty-sample run is for, and check it
claude Sep 7, 2026
1e5c19c
SBR case: say why the reference mean is flat, and band the forecast p…
claude Sep 7, 2026
e3e1e04
SBR case: the forecast legend name matches the regenerated figure
claude Sep 7, 2026
16008d4
Drop the "rests on" construction from the prose
claude Sep 8, 2026
68cfb6b
Point each case study at the full batch reading list
claude Sep 8, 2026
18b7337
FMC: show what the alignment did, and rename the readings heading
claude Sep 8, 2026
5a863a9
FMC: a figure for the batch-20 passage, traceable batches, plainer wo…
claude Sep 8, 2026
7bfaf8a
FMC: the chapter's score-plot labels pick a corner that is clear
claude Sep 8, 2026
bc7f477
FMC: the multiblock numbers as process-improve 1.83.0 computes them
claude Sep 8, 2026
8f54399
Shorten and break up the prose on the three batch case-study pages
claude Sep 8, 2026
3293c53
Drop the closing sentence of the DuPont overlay paragraph
claude Sep 8, 2026
2825991
Rewrite the batch case-study prose to the style guide
claude Sep 8, 2026
6c0eb92
Restore the flow the shortening pass took out
claude Sep 8, 2026
dd2014a
Caption: the parity panel now marks the same three batches
claude Sep 8, 2026
02ce8cb
Caption: the parity panel is coded like the score plot beside it
claude Sep 8, 2026
9981207
FMC: the model fits the high-solvent batches low, and why
claude Sep 8, 2026
5623f43
Stop explaining the library in prose that the code already shows
claude Sep 9, 2026
eae56c6
FMC: a table for the three single-block models, and what it does not say
claude Sep 9, 2026
174c5ac
FMC: say plainly what the block placement rule is and does
claude Sep 9, 2026
758b1b1
FMC: cumulative R2Y and Q2Y columns in both model tables
kgdunn Sep 9, 2026
c0842a2
Let the code checker verify the numbers it was silently dropping
kgdunn Sep 9, 2026
c0cf299
Correct what the three case studies claim, against the data and the p…
kgdunn Sep 9, 2026
bc28567
Make the figures show what the captions send the reader to look for
kgdunn Sep 9, 2026
640171a
Point the chapter's own arrow the right way, and tidy what repeats
kgdunn Sep 9, 2026
a783d9b
Merge remote-tracking branch 'origin/main' into claude/issues-154-156…
kgdunn Sep 9, 2026
5d6d004
Read the batch the section promised, and draw what the captions describe
kgdunn Sep 10, 2026
9a82eab
Name the units, and the phases the operating-condition block records
kgdunn Sep 10, 2026
6fafff9
The first quality component is a contrast, not a level
kgdunn Sep 10, 2026
3c8fb8d
Say what the held-out column shows, instead of warning the reader off it
kgdunn Sep 10, 2026
114cff0
Note what the PCA row needs before it can hold a number
kgdunn Sep 10, 2026
245e876
FMC: give the multiblock model its own row in the quality ladder
claude Sep 10, 2026
a786596
FMC: name the dryer temperature tag where its loading changes sign
claude Sep 10, 2026
4c9926a
FMC: cut the batch-20 detour from the missing-cell paragraph
claude Sep 10, 2026
43e6c5a
FMC: give the real reason the PCA row has no cross-validated value
claude Sep 10, 2026
e4c350b
FMC: give the PCA row a cross-validated number
claude Sep 10, 2026
f82c2f9
Say how many components the quality block supports, and fill the PCA row
claude Sep 10, 2026
4d0e81c
Drop the ladder metaphor from the FMC page
claude Sep 11, 2026
8215cf4
Name the two initial-condition blocks where the section opens
claude Sep 11, 2026
fe333dc
Cut the gloss on a negative Q2, and a fraction that did not hold
claude Sep 11, 2026
a39d783
Set the block names as maths in the model tables
claude Sep 11, 2026
2e71349
Say why the multiblock rows have no cross-validated value
claude Sep 11, 2026
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
7 changes: 6 additions & 1 deletion .github/workflows/check-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ name: Check book code
# It is a gate rather than advisory: if that pair stops resolving, the install
# instructions the chapter gives its readers no longer work, which is a book
# problem worth failing on.
#
# The whole chapter runs in that environment, so it needs every extra the
# chapter's other pages use as well: the batch case studies read their data from
# openmv.net workbooks, and the Excel reader lives in the [batch] extra. Neither
# extra pins plotly, so the pair still resolves against pyoptex's plotly 5.

on:
push:
Expand Down Expand Up @@ -154,5 +159,5 @@ jobs:
run: |
make check-code-chapter \
CHAPTER=product-development-product-improvement \
CHECK_WITH='process-improve[expt]' \
CHECK_WITH='process-improve[expt,batch]' \
CHECK_ALSO=pyoptex
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ keywords:
- multivariate data analysis
- batch data analysis
license: CC-BY-SA-4.0
version: "2026.09.08"
date-released: 2026-09-08
version: "2026.09.10"
date-released: 2026-09-10
repository-code: "https://github.com/kgdunn/pid-book"
url: "https://learnche.org/pid"
identifiers:
Expand Down
68 changes: 64 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,68 @@ same edits do not have to be made again.
- Do not refer to a table or figure before it appears in the text. If a
forward reference is unavoidable, point to it explicitly as "below".

**Length and focus**

- Say it once, briefly. A passage that restates what a figure, a caption
or a printed result already shows is cut, not trimmed. A first draft of
a paragraph is usually two to five times too long; keep the claim, its
reason and its consequence, and stop.
- Do not repeat numbers the reader can read off a plot or a table. Quote a
number only when it is not on a figure (an average over several curves,
the sample at which a curve crosses a threshold), and print it in the
code with the value echoed in a comment, so the checker verifies it.
- Explain a principle in general terms and keep case-specific numbers for
the results. "The early estimates scatter more widely than the final
scores" belongs in the explanation; "fourteen times more after four
samples" does not.
- Use bullets for a sequence of steps or a set of parallel facts, and do
not dive into detail inside them.
- Cut method history, alternative methods and "prior experience" asides
that the point does not need. The book is self-contained: never refer to
course notes or other material the reader does not have.
- One metric where one will do (the leave-one-batch-out RMSEP, not RMSEE
and RMSEP side by side).
- After describing a result, state its practical value in one or two
sentences, with the number that carries it, then stop.

**Paragraph construction**

- One idea per paragraph: claim, reason, consequence. Do not splice a
second idea on with a colon or a semicolon.
- Keep the example fixed inside an argument: not "ten samples" in one
sentence and "four samples" in the next for the same point.
- Reconcile statements a careful reader would set against each other (a
list that "is not used to build the model" while its batches sit in the
training set): say precisely what is used, and for what.
- A heading says what the section does for the reader ("The final model,
used to verify the unusual batches detected above"), not its topic.

**Figures and captions**

- Every score plot carries the percent of variance explained per component
on its axes, in square brackets.
- Annotate on the figure the thing the text discusses: an arrow for a
contribution direction, with a marker at its origin; a batch marked and
labelled when a later section uses it. Keep annotation text small.
- Markers must read on every background they cross (white face and dark
edge on top of bars). Labels never sit on other points: move them to the
other side of the marker, or onto a short leader line. Legends go where
the data are not.
- Beside a derived statistic, show the raw data (raw trajectories in a 2x2
panel beside contribution bars) rather than a second derived panel.
- Integer axis ticks for integer-like quantities; a band of one error, not
two, unless the text says why.
- A caption says what the reader should see and what it means ("Dots help
show how consistent each batch in the cluster is with the group").
- When the text claims that a quantity behaves in a certain way, show it
in a figure.

**Process**

- When a wording or style fix may recur elsewhere in the file, ask before
changing the other occurrences rather than assuming.
- For content edits, run `make text` and the code checker; do not run
`make html` or rebuild a review rendering unless asked.

## Every Python case in the book runs in CI

Expand Down Expand Up @@ -110,10 +168,12 @@ The contract, which any new or edited code must satisfy:
moves with it; do not paper over the warning.
- **Echoed results are checked, and a mismatch fails.** A comment right after a
`print(...)` that repeats its output (`# [0.255, 0.367, ...]`) is compared with
what the block printed. `make check-code` and CI run with `--strict-output`, so
a number that stops reproducing fails the chapter even though the code still
runs; the bare CLI reports mismatches without failing, which is easier to work
through when several are in flight. Use this idiom for every number the prose
what the block printed. Every `make check-code…` target and CI run with
`--strict-output`, so a number that stops reproducing fails the chapter even
though the code still runs, and a per-chapter or per-file run is as trustworthy
as the full one; invoking `tools/check_code_blocks.py` directly without the flag
reports mismatches without failing, which is easier to work through when several
are in flight. Use this idiom for every number the prose
then quotes. Print the value in the shape the comment claims: a dict repr drops
a trailing zero, and a Series or array repr carries full precision, so
`print(f"{value:.2f}")` beats `print(value)` when the prose quotes two decimals.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ check-code: ## Execute every Python case in the book (all chapters in parallel)
$(CHECK_RUN) pytest tests -n auto

check-code-chapter: ## One chapter, verbose: make check-code-chapter CHAPTER=least-squares-modelling
$(CHECK_RUN) python tools/check_code_blocks.py --chapter $(CHAPTER) -v
$(CHECK_RUN) python tools/check_code_blocks.py --chapter $(CHAPTER) --strict-output -v

check-code-file: ## One RST file, run after the files that precede it in its chapter
$(CHECK_RUN) python tools/check_code_blocks.py --file $(FILE) -v
$(CHECK_RUN) python tools/check_code_blocks.py --file $(FILE) --strict-output -v

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _LVM_contribution_plots:

Latent variable contribution plots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ How well is that direction determined?

This is the caveat promised earlier. Every number quoted so far comes from one model fitted to 26
cheeses, and the direction of the null
space rests on the second :math:`y`-loading, :math:`q_2 = -0.262`. That component was the one
space is set by the second :math:`y`-loading, :math:`q_2 = -0.262`. That component was the one
cross-validation did not keep. It adds 3.0% to :math:`R^2Y`, against 64.3% for the first. It is worth
asking how much of the geometry survives if the 26 cheeses had come out slightly differently.

Expand Down Expand Up @@ -998,8 +998,8 @@ deviation is a distance in the input space, measured between the two recipes the
Reading down the :math:`T^2` of the design, the moderate tastes near the middle of the calibration
range give designs with small :math:`T^2`, while the more extreme tastes push the design further from
the data: asking for a taste of 47.9 gives the largest value, 4.82. A large :math:`T^2` does not make
a design wrong, but it flags that the model is extrapolating and that the predicted taste rests on
less support from the data.
a design wrong, but it flags that the model is extrapolating and that less data stand behind
the predicted taste.
All four are well inside the 99% limit of 12.14.

The input-space deviation compares each design with the cheese that actually had that taste. Cheese 2 is
Expand Down
Loading
Loading