How do decision trees handle missing values?
mediumAnswer
- Options: (1) surrogate splits (CART's approach): find a backup feature that best mimics the chosen split's partition — used when the primary feature is missing at prediction time.
- (2) Default direction (XGBoost, LightGBM): during training, learn per split which direction — left or right — missing values should go.
- (3) Sentinel value: encode missingness as a specific value (e.g., -9999) and let the tree branch on it — works but hides information.
- (4) Impute first then train.
Check yourself — multiple choice
- Trees can't handle missing data
- Surrogate splits (CART) or a learned default direction (XGBoost/LightGBM) handle them natively
- Trees must always drop rows with NaN
- Only imputation works with trees
Surrogate splits (CART) or learned default direction (XGBoost/LightGBM) natively handle NaNs.
#decision-trees#missing-data#trees
Practise Supervised Learning
215 interview questions in this topic.
Related questions
- Gini impurity, entropy, and classification error — which do trees actually use?
- How do decision trees handle categorical features?
- Pre-pruning vs post-pruning in decision trees — what's the difference and when do you use each?
- How does cost-complexity (CCP) pruning work?
- What criterion does a regression tree use to choose splits?
- Why is a single decision tree considered a 'high-variance' model?