Skip to content

Batch phase 4: BatchPLS to final quality#462

Open
kgdunn wants to merge 1 commit into
claude/batch-phase3-transformersfrom
claude/batch-phase4-batchpls
Open

Batch phase 4: BatchPLS to final quality#462
kgdunn wants to merge 1 commit into
claude/batch-phase3-transformersfrom
claude/batch-phase4-batchpls

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds BatchPLS: batchwise-unfolded (multiway) PLS relating the unfolded [Z | X] batch matrix to a final-quality block Y (one row per batch), built by composition over multivariate.PLS. It mirrors BatchPCA's construction (batchwise unfold, optional initial-conditions Z join) but is supervised: it relates the initial conditions and time-varying trajectory deviations to the final product quality, and predicts the quality of a completed batch.
  • The X-weights keep the (tag, sequence) index so they reshape to a variable-by-time grid and plot with the existing time_varying_loading_plot. predict and transform return results in the input batch order.

This is Phase 4 (the final phase) of the batch modernization plan: the batch regression / prediction counterpart to BatchPCA.

Note on base branch: stacked on claude/batch-phase3-transformers (#461) → #460#459. GitHub retargets the base automatically as each parent merges. Review order: #459, #460, #461, then this.

Test plan

  • tests/batch/test_batch_pls.py: fit + predict on the real dryer dataset (scores shape, MultiIndex weights, R2, prediction correlates with quality); weights reshape to a (tag, time) grid; Z-block join; a synthetic batch whose quality is a known function of its trajectories is recovered; Y type/index guards; wrong-length rejection; transform returns scores
  • Full batch suite: 129 passed; ruff check . and mypy src/process_improve clean (144 files)

Note on the OWU phase

The originally-planned Phase 4 was observationwise unfolding (OWU / OWU-TBWU) plus maturity-variable alignment. Per your steer, OWU was dropped (batchwise unfolding only, one row per batch, Z included), so this phase delivers BatchPLS on that same [Z | X] matrix instead.

Checklist

  • Version bumped in pyproject.toml (MINOR: 1.57.0 -> 1.58.0) and CITATION.cff synced
  • Tests added or updated where relevant
  • ruff check . passes
  • CHANGELOG.md updated

🤖 Generated with Claude Code

https://claude.ai/code/session_01SyEpexCyqHn1rwTMYQSiP6


Generated by Claude Code

BatchPLS mirrors BatchPCA's construction (unfold the batches batchwise,
join an optional initial-conditions Z block onto the one-row-per-batch
matrix) but fits the existing multivariate.PLS against a batch-indexed
final-quality block Y. It relates the initial conditions and time-varying
trajectory deviations to the final product quality, and predicts the
quality of a completed batch. The X-weights keep the (tag, sequence)
index so they reshape to a variable-by-time grid and plot with
time_varying_loading_plot; predict and transform return results in the
input batch order.

Bumps to 1.58.0 with CITATION, CHANGELOG, and docs updates.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyEpexCyqHn1rwTMYQSiP6
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