Feature engineering and preprocessing · insight-0114
Let gradient boosting route missing values natively before building an imputer
- Evidence type
- documented fact
- Difficulty
- easy
- Roles
- Data scientist, ML engineer
- Industries
- cross-industry
Summary: situation, action, reason, boundary
Situation
You plan an imputation step in front of HistGradientBoosting, LightGBM or XGBoost.
Action
Start with native missing-value handling as the baseline; add imputation only if it beats native handling on the same folds or is required for serving consistency.
Reason
These boosters learn, per split, whether missing rows go left or right based on gain, so missingness becomes a learnable signal.
Boundary
HistGradientBoosting, LightGBM and XGBoost on tabular data with NaN values.
Symptom or risk
Imputation adds code and can hide informative missingness, while the booster could have learned where missing rows belong.
Exceptions
If missingness at serving time will differ from training (a field becomes mandatory), learned routing goes stale; fix the data contract first.
Trade-offs
Native handling is simple but less transparent; explicit imputation is auditable but adds assumptions.
Pitfalls
Encoding missing as zero; LightGBM treats zeros as ordinary values unless zero_as_missing is set, and zero may be a real value.
Lessons and concepts
Claims and their sources
HistGradientBoosting handles NaN natively; each split learns where missing samples go, and unseen-missing features send NaN to the child with more samples.
LightGBM handles missing values by default (use_missing) and only treats zeros as missing with zero_as_missing=true.