Skip to content

Write the batch process monitoring and improvement chapter - #272

Open
kgdunn wants to merge 6 commits into
mainfrom
claude/batch-mid-course-correction-hdnkzp
Open

Write the batch process monitoring and improvement chapter#272
kgdunn wants to merge 6 commits into
mainfrom
claude/batch-mid-course-correction-hdnkzp

Conversation

@kgdunn

@kgdunn kgdunn commented Aug 22, 2026

Copy link
Copy Markdown
Owner

The planned stub at product-development-product-improvement/batch-process-monitoring.rst (issue #74) becomes a full page for a mid-to-beginner reader, reworked so that a reader can decide when mid-course correction fits their own process and how to apply it, step by step.

Structure

  • The golden batch, and what replaying holds constant (the bundled nylon batches: five regulated tags repeat to 0.54 to 0.68% spread, the responding tags spread 1.9 to 7.4%).
  • Why the outcome varies anyway: the simulator as the same-batch counterfactual; a 200-batch replay campaign (mean 7.57 g/L, 4.24 to 9.83, 14.4% CV, reference 8.01 g/L); the variance decomposition with its four shares stated and the interaction share explained (31% initial conditions, 27% within-batch, 0.03% noise, 41% interaction).
  • When is mid-course correction the right tool? Four conditions, each with a check a plant can run on its own records (including a Z-only regression, Q2 0.23, as the plant-side stand-in for the decomposition), and a table placing the method among monitoring, end-point prediction and feedforward adaptation.
  • Predicting a batch while it runs: the unfolded row and the three kinds of column at a decision point (new schematic figure); on-line alignment through an indicator variable; the identification campaign in engineering units and its product cost; feed classes and the reference-move test for local models; trimmed score regression, the estimator's conditioning, and the prediction interval at the decision point as an equation, with a table of the per-class error by decision day; the monitoring funnel of one batch; and a held-out check of the prediction layer at every decision day (RMSEP, bias, coverage).
  • Correcting mid-course: the decision procedure as five steps, the optimisation written as an equation with each term named and attributed, the walkthrough with its gate numbers printed, and the two SPE limits explained.
  • The executed four-policy comparison, a sample-size comparison (60, 100, 200 training batches), the decision-day sweep with a data-only leverage measure and its executed counterpart, the exploration table and figure.
  • Applying it on a plant: an eight-step procedure, including what can and cannot be validated without a simulator, a computable offline consistency check, staged deployment with a calibration record, and re-basing golden-batch alarm bands.

Method change behind the numbers. The held-out check exposed that the previous prediction interval, built from the full-row training error, covered 70% of held-out outcomes at the decision point instead of 95% and could not see that one class's score estimator is ill-conditioned before day 4 (condition number 8e5 at day 2, projections of -146 g/L for a batch that finished at 8.15). kgdunn/process-improve#541 builds the interval at the decision point; every number on this page is re-measured against it: the funnel narrows from +/-4.0 g/L at day 0.5 to +/-1.75 at day 4, the dead band asks that the whole interval fall short of the target, five batches are corrected in the campaign (none harmed; sd 1.198 to 0.782 g/L; 67% of the oracle's mean improvement), and the decision-day sweep no longer harms early.

Review. Six-lens review (practitioner, referee against the four primary sources and the package code, first-time reader, numbers against the run logs, house style, structure): 59 findings, 55 applied, 4 refuted by measurement; the attributions to Yabuki and MacGregor, Flores-Cerrillo and MacGregor, Arteaga and Ferrer, Garcia-Munoz, Kourti and MacGregor, Nomikos and MacGregor, and Golshan and co-workers were each checked against the paper text.

Verified. Every number in the prose reproduces from the chapter's own code blocks run top to bottom against process-improve 1.80 (kgdunn/process-improve#541). make text: zero warnings. make html: succeeds, grep -r goatcounter _build/html/contents returns zero hits. Review render checked for zero horizontal overflow at 375 to 1440 px. CITATION.cff bumped to 2026.09.05. CLAUDE.md carries the review-render rule.

Companion PRs. Figures: kgdunn/figures#83 (ten PNGs, three scripts; merges first, until then this PR's PDF step fails on the missing images, the known scheduling artifact). Code: kgdunn/process-improve#541 (MidCourseCorrector.predict, the per-decision-point interval, the dead-band default, a knot bug fix; version 1.80.0).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra

The planned stub becomes a full page with a single arc: the golden
batch and what replaying it can and cannot hold constant (real nylon
data: regulated variables repeat to 0.5%, responding variables spread
7.4%); why the outcome still varies, dissected with the bioreactor
simulator (replay campaign spread, the variance decomposition into a
before-batch share and a during-batch share, and the feed classes in
the Z block); predicting a running batch as a missing-data problem
(trimmed score regression, with the per-decision-point prediction of
one poor batch); and mid-course correction (the Yabuki-MacGregor dead
band and validity gate, the Flores-Cerrillo quadratic program with
every term translated, per-feed-class local models and why a single
global linear model misdirects).

Every claimed improvement is executed, not predicted: the corrected
schedules are re-simulated with identical disturbances. Headline,
forty fresh batches: replay 7.51 +/- 1.20 g/L, corrected 7.71 +/- 0.78
(four corrected, all in the poorest class, +1.53 to +2.67 g/L each,
none harmed), against an oracle-from-the-decision-point ceiling of
7.83 and a perfect-feedforward ceiling of 7.82 whose minimum is worse
than the corrected policy's. A decision-point sweep locates the
correction window mid-batch, and an exploration-dial sweep measures
the validity-limit trade-off against the true process.

Every number in the prose reproduces from the chapter's own code
blocks against process-improve 1.68.0 (verified by running them);
make text builds with zero warnings; make html passes with no
goatcounter strings. Citation version and date bumped.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
claude added 2 commits August 22, 2026 07:39
Checked every credited claim against the primary sources. The corrections
matter because the people cited are likely readers of this page.

- Flores-Cerrillo and MacGregor optimise an adjustment to the latent
  variable scores and recover the remaining trajectories by inverting the
  PLS model. The chapter previously described their method as an
  optimisation over the future manipulated-variable columns, which is what
  this implementation does, not what they do. Both are now stated, with the
  trade-off between them.
- The SPE penalty on the candidate row, the hard caps, the actuator bounds,
  the rate limits and the knot parameterisation are additions here, not
  theirs. Their formulation carries the soft T2 term; SPE appears in their
  paper as a validity check on the measurements, before any correction.
- The SPE validity gate is therefore attributed to the latent variable form
  of the method, not to Yabuki and MacGregor, whose 1997 formulation
  predates it. The no-correction dead band remains theirs: it is their
  no-control region.
- Garcia-Munoz, Kourti and MacGregor found conditional mean replacement and
  trimmed score regression jointly best, giving almost identical
  predictions, rather than recommending trimmed score regression alone.
- Their nylon study identified the controller from 45 batches, 30 with
  deliberate moves, and reported adequate control from as few as 15 (10
  with moves). The chapter said it needed 30, the opposite of the paper's
  own conclusion about modest data requirements.
- Published gains are not almost always predictions: Flores-Cerrillo and
  MacGregor obtained their nylon final qualities by rerunning the
  non-linear model with the computed trajectories. It is industrial case
  studies, where execution is unavailable, that report predictions.
- At a decision point the future setpoint columns are not missing; they are
  set to the schedule under consideration, as in the source paper. Only the
  future measured trajectories are estimated.
- The Z block joined to the unfolded trajectories is credited to Kourti,
  Nomikos and MacGregor alongside the Nomikos-MacGregor unfolding.
- With hard SPE and T2 caps the program is quadratically constrained, not a
  quadratic program; both forms are now described.
- Yabuki and MacGregor's DOI was wrong (10.1021/ie960599o resolves to
  nothing); corrected to 10.1021/ie960536m. Added the missing DOIs for
  Flores-Cerrillo and Garcia-Munoz, and moved Golshan et al. out of the
  methods-used-here list, since LV-MPC addresses setpoint tracking rather
  than the mid-course correction problem implemented on this page.

Also records the review-render rule in CLAUDE.md: these HTML artifacts must
not scroll horizontally at any zoom, verified in headless Chromium.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
The author-voice and pedagogy passes of the adversarial review, with two
findings checked against the code and the data rather than taken as read.

Corrected because they were wrong, not merely infelicitous:

- The dead-band explanation at day 2 contradicted the dead band's own
  definition. The text said uncertain predictions make the band pass more
  batches, but a wider prediction interval makes the band pass fewer. The
  real mechanism is that early projections scatter around where batches
  actually land, so acceptable batches project below target and the same
  scatter misdirects the correction. Stated that way instead.
- The claim that the oracle's schedules reach 5 degC above anything in the
  training campaigns is false: the training campaigns already reach
  39.1 degC against a 39.0 degC actuator ceiling, and the corrector is
  capped below that at 38.7 degC. What actually puts the best schedule
  outside the supported region is an unusual combination of setpoints, a
  warm hold carried past the nominal cooling day, which is what T2
  measures. Rewritten to say so, which also explains what T2 is.
- The variance-decomposition parenthetical enumerated cases the function
  does not run. It runs four campaigns: all channels, then each alone. The
  count was right and the enumeration wrong.
- Tag06's spread is quoted to two figures (0.54%) so that the stated ratio
  to Tag10's 7.38% reproduces as about fourteen times; from the previously
  displayed 0.5% a reader recomputing would get fifteen.

Pedagogy: define "decision point" and "knots" at first use; explain
alignment before the first code block uses it; give the monitoring figure
the prediction-interval and target context it needs to be read; state the
seeding contract that makes the corrected re-run a same-batch
counterfactual; say that the campaign wrapper rebuilds the pipeline
assembled by hand; name the parameter the decision-day sweep varies; extend
the correction code block to draw both panels the figure shows; drop an
unused import; name the "mean gain" column's denominator.

Voice: positional cross-references replaced with labelled :ref: links;
idioms, monetary metaphors, anthropomorphisms and editorial asides replaced
with plain statements; three long paragraphs split; units added to the
policy table headers and one precision used for the same quantities in the
table and the prose.

make text: zero warnings. make html: succeeds, no goatcounter hits.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
…ection

The chapter read as a demonstration; a reader could not tell whether the
method fitted their own process or what the steps were. It now has a
section on when mid-course correction is the right tool (four conditions,
each with a check a plant can run on its own records, and a table placing
the method among monitoring, end-point prediction and feedforward
adaptation), and a closing procedure for a plant, including what can and
cannot be validated without a simulator and how to deploy in stages with a
calibration record.

The prediction section now states the three kinds of column at a decision
point (with a new schematic), trimmed score regression, the conditioning
of the estimator, and the prediction interval at the decision point as an
equation, and adds a held-out check of the prediction layer at every
decision day. That check exposed that the previous interval, built from
the full-row training error, covered 70% of held-out outcomes instead of
95% and was blind to the ill-conditioned early projections of one class;
process-improve 1.79 builds the interval at the decision point, and every
number on this page is re-measured against it: the funnel now narrows
from +/-4.0 g/L at day 0.5 to +/-1.75 at day 4, the dead band asks that
the whole interval fall short of the target, five batches are corrected
in the campaign comparison (none harmed, sd 1.20 to 0.78 g/L), and the
decision-day sweep no longer harms early.

Also: the variance decomposition's four shares are stated with their
numbers and the interaction share explained; the correction is written as
an equation with each term named; the replay campaign is 200 batches and
the Z-score plot uses the training campaign, so figures and chapter code
agree; and the six dictated wording corrections are applied.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
Fifty-nine findings from practitioner, referee, first-reader, numbers and
house-style reviews; the ones that held are applied. The larger additions
are what a plant needs and the demonstration had skipped: on-line
alignment through a real-time indicator variable; the size and cost of the
excitation campaign in engineering units; how to form the feed classes on
a plant and the reference-move test for whether local models are needed;
which columns hold recorded values and which hold setpoints, and why that
matters where a loop saturates; a computable offline consistency check of
the model's predicted effect of past schedule moves; a data-only leverage
measure by decision day, with its executed counterpart showing what it
does and does not capture; bounds as the narrower of actuator and
permitted operating range; re-basing golden-batch alarm bands; and a
measured sample-size comparison (60, 100 and 200 training batches) showing
over-fitting at 60 and half the gain at 100.

Accuracy fixes: the interval at day 0.5 does not reach the floor (only day
1.5 does); class A's estimator is still ill-conditioned at day 3 and the
day-3 improvement belongs to class C's shrinking error; the day-2 sweep
corrects five batches, not fewer; the corrected schedule's descent rate
holds only to day 5.5; the full-row error is quoted on the same degrees of
freedom as the table; the oracle row is a local search and hence a lower
bound on the ceiling; model inversion can carry actuator limits indirectly
(Golshan and co-workers); the per-time score covariance is Nomikos and
MacGregor's; the package's trimmed score regression is the A-component
reconstruction of Arteaga and Ferrer's; Flores-Cerrillo and MacGregor's
data-requirement finding is stated as what their data satisfied rather
than as a requirement they stated; and the two SPE limits at a decision
point are explained. Three cross-references pointed at the wrong labels
and are retargeted; every positional reference is now an explicit link;
the disturbance-free reference, training mean and class agreement are
computed on the page rather than asserted.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
The chapter rework is a substantive change, so the calendar version and
release date move to today, as the repository rules require for any
pull request beyond a typo fix.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants