Skip to content

feat: ensemble support for mixed per-estimator preprocessors - #72

Merged
rxavier merged 2 commits into
mainfrom
feat/ensemble-mixed-preprocessors
Aug 3, 2026
Merged

rxavier merged 2 commits into
mainfrom
feat/ensemble-mixed-preprocessors

Conversation

@rxavier

@rxavier rxavier commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Part 2, step 4 (final block) of the ML defaults improvements plan (docs/ml-defaults-improvements.md).

Changes

  • _make_pipeline gains an include_preprocessor knob (None = resolve from self.preprocess, False = bare pipeline); add_estimators forwards it.
  • build_ensemble now inspects the members' preprocessor_map:
    • Same preprocessor (e.g. all default or all native): current behavior — bare members, ensemble wrapped in that preprocessor (preprocessing runs once), and the ensemble is mapped to it.
    • Mixed: each member contributes its full pipeline (sklearn ensembles accept Pipelines) and the ensemble is added bare (no outer preprocessor).
  • _configure_native_estimator exempts ensembles (Voting/Stacking), whose member estimators were already validated, so an all-native ensemble can be wrapped in the native preprocessor.

Tests (5 new)

All-default ensemble uses default with bare members; all-native ensemble uses native and fits/scores; mixed ensemble (voting + stacking, parametrized) is bare with full-pipeline members and fits/scores with no NaNs.

All 276 tests pass; coverage 89.8% (gate 85%); ruff + format clean.

rxavier added 2 commits August 3, 2026 02:13
Implements the ML defaults improvements Part 2, step 4.

- _make_pipeline gains an include_preprocessor knob (None = resolve from
  self.preprocess, False = bare) and add_estimators forwards it
- build_ensemble: if all selected members map to the same preprocessor, keep
  current behavior (bare members, ensemble wrapped in that preprocessor,
  preprocessing runs once); if members are mixed, each member contributes its
  full pipeline and the ensemble is added bare
- _configure_native_estimator exempts ensembles (Voting/Stacking), whose
  members are already validated, so an all-native ensemble can be wrapped in
  the native preprocessor

Tests: all-default ensemble uses default, all-native ensemble uses native and
fits, mixed ensemble (voting + stacking) is bare with full-pipeline members
and fits/scores. All 276 tests pass.
- guide: fix the stale datetime pipeline row (median imputer + scaler),
  note VarianceThreshold is default-profile only, expand the
  per-estimator preprocessors section (registry API, native validation,
  reassign_types propagation, ensemble behavior for same vs mixed
  preprocessors), and mention the preprocessor selector in mutators and
  ensembles
- README: update the preprocessing feature-overview row and list the new
  preprocessing example
- examples: add 03_preprocessing.py covering the default profile, the
  native HGB profile via preprocessor_map, and runtime template
  registration/assignment; executed in CI via test_examples
@rxavier
rxavier merged commit 8afcf0c into main Aug 3, 2026
13 checks passed
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.

1 participant