Skip to content

feat: HistGradientBoosting defaults to the native preprocessor - #73

Merged
rxavier merged 1 commit into
mainfrom
feat/hgb-native-by-default
Aug 3, 2026
Merged

rxavier merged 1 commit into
mainfrom
feat/hgb-native-by-default

Conversation

@rxavier

@rxavier rxavier commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

HGB previously shared the default impute+scale+encode preprocessor with every other estimator, discarding the missingness and categorical structure it can handle natively. Now any HistGradientBoosting* estimator without an explicit preprocessor_map entry automatically uses the "native" profile.

Changes

  • New _effective_preprocessor_map(): user-supplied entries win; HGB estimators default to "native". preprocessor_map still only shows non-default entries, so a plain PoniardRegressor() now reports {"HistGradientBoostingRegressor": "native"}.
  • The auto-default is skipped when a custom (non-PoniardPreprocessor) preprocessor is supplied — the user has taken over preprocessing, so every estimator uses their template unless explicitly mapped.
  • _build_preprocessors now computes feature_types when the default is a custom pipeline, fixing a latent KeyError when building "native" on demand with a custom preprocessor.
  • Guide + 03_preprocessing.py updated; README row tweaked.

Behavior

  • Override back to imputed preprocessing with preprocessor_map={"HistGradientBoostingClassifier": "default"}.

Tests (4 new, 1 updated)

Auto-default for HGB (and from_dtype side effect), explicit override to default, custom-preprocessor skips auto-mapping, and on-demand native with a custom preprocessor.

All 281 tests pass; coverage 90.1% (gate 85%); ruff + format clean. Intended for the 0.7.1 release.

Previously HGB shared the default impute+scale+encode preprocessor like every
other estimator, discarding the missingness and categorical structure it can
handle natively. Now any HGB estimator without an explicit preprocessor_map
entry automatically uses the "native" profile.

- _effective_preprocessor_map() adds HGB→native defaults (user entries win),
  so preprocessor_map shows only the non-default mappings
- The auto-default is skipped when a custom (non-PoniardPreprocessor)
  preprocessor is supplied: the user has taken over preprocessing, so every
  estimator uses their template unless explicitly mapped
- _build_preprocessors now computes feature_types when the default is a custom
  pipeline, fixing a latent KeyError when building "native" on demand with a
  custom preprocessor
- guide + example updated; new tests for the auto-default, explicit override,
  and custom-preprocessor skip

Closes #73-style follow-up: HGB no longer shares the rest's preprocessor by
default. All 281 tests pass; coverage 90.1%.
@rxavier
rxavier merged commit 82f9b15 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