Skip to content

feat(ml): remappers#1708

Merged
dlovell merged 4 commits intomainfrom
feat/ml/remappers
Mar 11, 2026
Merged

feat(ml): remappers#1708
dlovell merged 4 commits intomainfrom
feat/ml/remappers

Conversation

@dlovell
Copy link
Collaborator

@dlovell dlovell commented Mar 11, 2026

No description provided.

dlovell and others added 2 commits March 11, 2026 08:28
ColumnRemapper: inspect and remap ColumnTransformer column references
using fully path-qualified slash-separated keys (e.g. "preprocessor/num").
Validates keys against list_column_refs; strict=True requires full coverage.

ParamRemapper: remap arbitrary sklearn params using __ convention
(e.g. "classifier__C", "preprocessor__num__imputer__strategy").
Supports whole-step replacement via exact name match. Validates keys
against pipeline.get_params(deep=True); strict=True requires full coverage.

Both classes are @attr.frozen with @property/@cache derived views.
Reconstruction is immutable throughout — no setattr, no clone-then-mutate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both methods apply the corresponding remapper to Pipeline.instance and
return a new Pipeline.from_instance(remapped). Imports are local to
avoid circular dependencies. strict= is forwarded to remap().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dlovell dlovell requested a review from ghoersti March 11, 2026 12:35
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 92.94118% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
python/xorq/expr/ml/sklearn_utils.py 88.88% 12 Missing ⚠️
Files with missing lines Coverage Δ
python/xorq/expr/ml/pipeline_lib.py 90.20% <100.00%> (+0.18%) ⬆️
python/xorq/expr/ml/tests/test_pipeline_lib.py 98.66% <100.00%> (+0.18%) ⬆️
python/xorq/expr/ml/sklearn_utils.py 88.88% <88.88%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 11, 2026

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing feat/ml/remappers (99aa93d) with main (7b0c576)

Open in CodSpeed

dlovell and others added 2 commits March 11, 2026 09:07
Covers: basic remapping, immutability of original, return type, unknown
key errors, strict mode, nested params, and whole-step replacement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sklearn_utils imports sklearn at module level, so importing ColumnRemapper
before pytest.importorskip("sklearn") caused an unconditional sklearn import
at collection time, breaking test collection when sklearn is not installed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dlovell dlovell marked this pull request as ready for review March 11, 2026 18:18
@dlovell dlovell merged commit f9d19bf into main Mar 11, 2026
25 checks passed
@dlovell dlovell deleted the feat/ml/remappers branch March 11, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants