Repository navigation
feat: native preprocessing profile for HistGradientBoosting - #71
Merged
Merged
Conversation
Implements the ML defaults improvements Part 2, step 3. PoniardPreprocessor gains a profile parameter (default | native): - native leaves numeric and datetime features untouched (NaN passthrough) and ordinal-encodes categoricals to pandas category dtype via a small _ToCategorical transformer, preserving NaN as missing - native skips imputation, scaling and VarianceThreshold - verified NaN semantics: HistGradientBoosting with categorical_features="from_dtype" treats NaN in categorical columns as missing and splits on them natively Estimator wiring: - preprocessor_map can reference "native"; the profile is built with the shared feature_types (inference runs once, reassign_types propagates to every PoniardPreprocessor profile) - set_preprocessor(est, "native") builds the profile on demand after setup - _make_pipeline couples "native" to HistGradientBoosting estimators only (ValueError otherwise) and auto-sets categorical_features="from_dtype" - guide documents the profile and the side effect Tests: mapped/on-demand native, non-HGB rejection, NaN-categorical E2E, reassign_types shared inference, step targeting, save/load round-trip, tuning, and the PoniardPreprocessor native profile. All 272 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part 2, step 3 of the ML defaults improvements plan (
docs/ml-defaults-improvements.md): the"native"profile + HGB wiring.PoniardPreprocessor
profileparameter ("default"|"native").categorydtype via a small_ToCategoricaltransformer. No imputation, no scaling, noVarianceThreshold.HistGradientBoostingwithcategorical_features="from_dtype"treats NaN in categorical columns as missing and handles them natively.Estimator wiring
preprocessor_mapcan reference"native"; the profile is built with the sharedfeature_types(inference runs exactly once;reassign_typespropagates to every PoniardPreprocessor-backed profile).set_preprocessor(est, "native")builds the profile on demand aftersetup._make_pipeline(single consumption point) couples"native"toHistGradientBoosting*estimators only — mapping it to anything else raisesValueError— and auto-setscategorical_features="from_dtype"on the cloned estimator (documented side effect).Tests (12 new/updated)
Mapped + on-demand native, non-HGB rejection (both API paths), NaN-categorical E2E,
reassign_typesshared inference, step targeting on native, save/load round-trip, tuning withpreprocessor__...keys, and the nativePoniardPreprocessorprofile directly.All 272 tests pass; coverage 89.7% (gate 85%); ruff + format clean.