Why do tree ensembles handle mixed categorical and numerical features better than linear models?
Quick Overview
Asks why tree ensembles cope with a mix of categorical and numerical features more easily than linear models. It tests understanding of how tree splits treat scale, categories, interactions and missing values, and where that advantage stops.
Why do tree ensembles handle mixed categorical and numerical features better than linear models?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
Why do tree ensembles handle mixed categorical and numerical features better than linear models?
Picture a tabular dataset that mixes numeric columns (prices, counts, ratios) with categorical ones (region, device type, product category).
```hint What a split looks at
Look at what information a single tree split uses from a numeric column and from a categorical column, and compare that with what a linear model needs from each input.
```
```hint Interactions
Think about how each model would represent a price effect that differs by region.
```
### What a Strong Answer Covers
- Why tree splits are unaffected by feature scale and monotone transforms, and what a linear model needs instead
- How native tree implementations handle categorical features, compared with one-hot or target encoding for a linear model
- How trees capture interactions across feature types without hand-built terms
- How each model family deals with missing values and outliers in the inputs
- The limits: high-cardinality categoricals, libraries without native categorical support, and cases where a linear model is still the better fit
### Follow-up Questions
- How does a gradient boosting library find a good split over a categorical feature with many levels without trying every subset?
- Why can target encoding leak the label, and how do ordered target statistics avoid it?
- When would you still choose a linear model on mixed tabular data?
- Does a tree ensemble trained on one-hot encoded categories behave differently from one that splits on categories natively?
Overview: Asks why tree ensembles cope with a mix of categorical and numerical features more easily than linear models. It tests understanding of how tree splits treat scale, categories, interactions and missing values, and where that advantage stops.