Batch phase 2: online Nomikos-MacGregor monitoring#460
Open
kgdunn wants to merge 1 commit into
Open
Conversation
BatchPCA.predict_online projects a partially-observed batch onto the model by projection to the model plane (PMP): future trajectory columns are treated as missing and the score is the least-squares fit of the observed columns onto the loadings, with initial conditions always observed. At full observation it matches BatchPCA.diagnose. BatchMonitor builds time-varying T2 and SPE control limits by running every good batch through predict_online at each time sample and summarising the good-batch spread (spe_calculation per sample; the analytical F-based T2 limit). monitor() tracks a new batch sample by sample and flags where each statistic exceeds its limit. online_monitoring_plot draws the trace over the limit band with alarm markers. Bumps to 1.56.0 with CITATION, CHANGELOG, and docs updates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyEpexCyqHn1rwTMYQSiP6
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BatchPCA.predict_online: projection to the model plane (PMP) for a partially-observed batch. At each time sample the future trajectory columns are treated as missing and the score is the least-squares fit of the observed columns onto the loadings (t = pinv(P_obs) @ x_obs); initial conditions, known from the batch start, are always observed. At full observation it matchesBatchPCA.diagnoseexactly.BatchMonitor: builds time-varying Hotelling's T2 and SPE control limits by running every good batch throughpredict_onlineat each sample and summarising the good-batch spread (spe_calculationper sample; the analytical F-based T2 limit).monitor()tracks a new batch sample-by-sample and flags the samples where each statistic exceeds its limit.online_monitoring_plot: the online SPE/T2 chart, drawing the batch trace over the time-varying limit and the mean good-batch trace, with alarm samples marked.This is Phase 2 of the batch modernization plan (online monitoring). It builds on the offline
BatchPCAfrom Phase 1.Note on base branch: this PR is stacked on
claude/process-improve-library-review-9h1fn2(Phase 1, #459), sincepredict_onlineis a method onBatchPCAwhich isn't merged yet. GitHub will retarget the base tomainautomatically once #459 merges. Review #459 first.Test plan
tests/batch/test_batch_monitor.py: PMP matchesdiagnoseat full observation;upto_kbounds; limit shapes; a good training batch stays mostly in-limit; a large injected fault in a real nylon batch trips SPE in the fault window;upto_ktruncation; initial-conditions threaded end-to-endtests/batch/test_batch_plots.py: online monitoring plot builds for SPE and T2; bad-statistic guardruff check .andmypy src/process_improveclean (142 files)Checklist
pyproject.toml(MINOR: 1.55.0 -> 1.56.0) andCITATION.cffsyncedruff check .passesCHANGELOG.mdupdated🤖 Generated with Claude Code
https://claude.ai/code/session_01SyEpexCyqHn1rwTMYQSiP6
Generated by Claude Code