Skip to content

Add golden-batch and mid-course-correction figures for the batch chapter - #83

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

Add golden-batch and mid-course-correction figures for the batch chapter#83
kgdunn wants to merge 3 commits into
mainfrom
claude/batch-mid-course-correction-hdnkzp

Conversation

@kgdunn

@kgdunn kgdunn commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Ten PNGs and their three generator scripts, in the house matplotlib dialect (Okabe-Ito palette, DPI 300, save() helper, output directory from argv), for the batch process monitoring and control chapter.

Companion PRs: the chapter that embeds these figures is kgdunn/pid-book#272; the modelling and control code they exercise is kgdunn/process-improve#541 (process-improve[control]>=1.80, which builds the mid-course prediction interval at the decision point). Merge order: process-improve first, then this PR, then the book PR (its PDF step stays red until these files are on main).

batch/golden-batch-figures.py (4 PNGs)

  • golden-batch-nylon-spread.png: the bundled nylon batches; setpoint replication at sub-percent spread while the response spread is roughly 14 times wider.
  • golden-batch-replay-spread.png: 200 simulator batches replaying the identical golden schedule (the same campaign the chapter regresses on Z); final titers 4.24 to 9.83 g/L (14.4% CV) around the 8.01 g/L reference.
  • golden-batch-z-scores.png: the initial-conditions score plot of the chapter's own 200-batch training campaign with the A/B/C feed classes (81, 71, 48 batches) as overlapping ranges along the first component; nearest-centroid assignment agrees with the true class 84.5% of the time.
  • golden-batch-variance-decomposition.png: the four variance shares (initial conditions 31%, within-batch disturbances 27%, noise 0.03%, interaction 41%).

batch/mcc-decision-point-row.py (1 PNG, schematic)

  • mcc-decision-point-row.png: the unfolded row (11 pre-batch values, then 20 samples of each of 5 tags: 111 columns) drawn twice: a complete training batch, and a running batch at the day-4 decision point with its three kinds of column (known; missing and estimated; the schedule under consideration).

batch/midcourse-correction-figures.py (5 PNGs)

Every quantitative claim is executed on the simulator (corrected schedules re-simulated under the same disturbance seed), replicating evaluate_control_policies(y_target=8.0, random_state=0) at its new default dead band of 1.0 (the whole prediction interval must fall short of the target):

  • mcc-monitoring-funnel.png: one poor batch's predicted final titer at every decision point with the 95% prediction band built at that decision point; it narrows from ±4.0 g/L at day 0.5 to ±1.75 at day 4 and ±0.9 at day 9.5.
  • mcc-correction-at-k.png: that batch's temperature and pH schedules before and after the day-4 correction (3.66 to 5.79 g/L executed).
  • mcc-policy-comparison.png: 40 batches under four executed policies: replay 7.51 ± 1.20, mid-course 7.75 ± 0.78 (5 corrected, none harmed), oracle-from-k 7.87 ± 0.63, adapted feedforward 7.82 ± 1.01 g/L.
  • mcc-decision-point-window.png: mean executed gain versus decision-point placement; the window is days 3 to 5 with the largest gain at day 4, and the early side no longer harms because the interval at the decision point refuses the ill-conditioned early projections.
  • mcc-exploration-dial.png: predicted versus executed titer of the corrected batches as the T2 penalty is relaxed, caps off (executed 6.30 to 6.98 g/L, above the prediction at every setting).

Both data scripts print the numbers each figure rests on when they run. Regeneration commands are in each module docstring; the MCC set takes roughly 20 minutes because the policy comparison and the two sweeps are re-executed, not read from a cache.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra

Nine PNGs and their two generator scripts for the new batch process
monitoring and control chapter in the book. Every quantitative claim in
the mid-course-correction set is executed on the calibrated bioreactor
simulator (corrected schedules re-simulated under the same disturbance
seed), replicating the documented headline of
evaluate_control_policies(y_target=8.0, random_state=0) in
process-improve 1.68.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
…e row schematic

The mid-course figures now come from process-improve 1.79, whose
MidCourseCorrector builds the prediction interval at the decision point
(the training batches re-projected under the same missingness pattern)
and whose dead band defaults to 1.0, the whole interval falling short of
the target. The funnel figure therefore narrows as the batch runs
(+/-4.0 g/L at day 0.5 to +/-1.75 at day 4), where the old interval was
flat; five batches are corrected in the campaign comparison instead of
four; and the decision-day sweep no longer harms early, because the
interval refuses the ill-conditioned early projections, so the window
band moves to days 3 to 5 with the peak at day 4.

The replay-spread figure uses the 200-batch replay campaign the chapter
also regresses on Z, and the Z-score plot uses the chapter's own
training campaign, so the plotted batches are the ones the per-class
models are fitted on. New: mcc-decision-point-row.png, a schematic of
the unfolded row (11 pre-batch values then 20 samples of 5 tags) and of
the three kinds of column at a decision point (known, missing and
estimated, the schedule under consideration). Both scripts print the
numbers each figure rests on when they run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZAyiPT8xURSdi24yFKCra
MidCourseCorrector.predict, which the monitoring funnel figure calls,
ships in process-improve 1.80.0: main took 1.79.0 for an unrelated
change, so the install line's floor moves up by one minor version.

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