Skip to content

Batch phase 3: sklearn transformer facades and f_rupture#461

Open
kgdunn wants to merge 1 commit into
claude/batch-phase2-online-monitoringfrom
claude/batch-phase3-transformers
Open

Batch phase 3: sklearn transformer facades and f_rupture#461
kgdunn wants to merge 1 commit into
claude/batch-phase2-online-monitoringfrom
claude/batch-phase3-transformers

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds sklearn BaseEstimator / TransformerMixin facades over the existing batch free functions, so a batch workflow can be expressed as a pipeline and the learned state is carried on the fitted estimator: BatchScaler (range scaling with inverse_transform), ResampleAligner (linear resampling to a common length), DTWAligner (iterative weighted DTW that learns a reference and weights and aligns new batches to them), and BatchFeatureExtractor (a batch dict to a batch-by-feature matrix suitable as the X block of a PLS-to-quality model). The free functions are unchanged and remain the implementation layer.
  • Implements the previously-stubbed f_rupture via the optional ruptures library (PELT changepoint detection), and re-points the batch extra to ruptures - it previously declared openpyxl and scikit-image, which were imported nowhere.

This is Phase 3 of the batch modernization plan (pipeline ergonomics + feature completion).

Note on base branch: stacked on claude/batch-phase2-online-monitoring (#460), which is stacked on Phase 1 (#459). GitHub will retarget the base automatically as each parent merges. Review #459, then #460, then this.

Test plan

  • tests/batch/test_transformers.py: scaler round-trip; resampler equal-length + auto-reference; DTW aligns the training set and a held-out batch to the reference length; feature matrix shape/index and feeding a PLS model; unknown-feature guard; f_rupture detects an injected step (guarded by importorskip("ruptures")) and rejects multi-column input
  • Full batch suite: 121 passed; ruff check . and mypy src/process_improve clean

Checklist

  • Version bumped in pyproject.toml (MINOR: 1.56.0 -> 1.57.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

Adds BaseEstimator/TransformerMixin facades over the existing batch
free functions so a batch workflow can be an sklearn pipeline, with the
learned state carried on the fitted estimator: BatchScaler (range
scaling with inverse_transform), ResampleAligner (linear resampling to
a common length), DTWAligner (iterative weighted DTW, learning a
reference and weights and aligning new batches to them), and
BatchFeatureExtractor (batch dict to a batch-by-feature matrix for
PLS-to-quality). The free functions are unchanged and remain the
implementation layer.

Implements the previously-stubbed f_rupture via the optional ruptures
library (PELT changepoint detection), and re-points the batch extra to
ruptures - it previously declared openpyxl and scikit-image, which were
imported nowhere.

Bumps to 1.57.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