Why can tree-based models capture non-linear relationships out of the box while linear models need basis expansions?

Quick Overview

Asks why decision trees model non-linear relationships and feature interactions without extra features, while linear models need basis expansions to do the same. Tests understanding of how each model family represents functions and the trade-offs in smoothness, extrapolation and variance.

Why can tree-based models capture non-linear relationships out of the box while linear models need basis expansions?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why can tree-based models capture non-linear relationships out of the box while linear models need explicit basis expansions? ```hint Write the model as a formula Write a fitted tree's prediction as a formula over regions of the input space, then compare it with $w^\top x + b$. Ask who chose the functions being summed in each case. ``` ```hint Follow one path Take a single root-to-leaf path and ask what condition on the inputs it represents. ``` ### What a Strong Answer Covers - How a fitted tree's prediction can be written as a formula, and who chooses its building blocks - How trees and linear models handle feature interactions - What a linear model can represent, and how basis expansions or kernels extend it - The trade-offs between the two: smoothness, extrapolation, variance and interpretability ### Follow-up Questions - A depth-2 tree is trained on a pure XOR pattern of two features. Why can greedy splitting struggle at the root? - How do gradient-boosted trees fit a smooth curve such as $y = \sin(x)$, and what do their predictions look like outside the training range? - When would you prefer a spline-based generalized additive model over gradient boosting? - How do you choose the number and placement of spline knots, and how does that compare with how a tree picks its thresholds?

Overview: Asks why decision trees model non-linear relationships and feature interactions without extra features, while linear models need basis expansions to do the same. Tests understanding of how each model family represents functions and the trade-offs in smoothness, extrapolation and variance.

Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

Why can tree-based models capture non-linear relationships out of the box while linear models need explicit basis expansions?

What a Strong Answer Covers Guidance

  • How a fitted tree's prediction can be written as a formula, and who chooses its building blocks
  • How trees and linear models handle feature interactions
  • What a linear model can represent, and how basis expansions or kernels extend it
  • The trade-offs between the two: smoothness, extrapolation, variance and interpretability

Follow-up Questions Guidance

  • A depth-2 tree is trained on a pure XOR pattern of two features. Why can greedy splitting struggle at the root?
  • How do gradient-boosted trees fit a smooth curve such as y=sin⁡(x)y = \sin(x) , and what do their predictions look like outside the training range?
  • When would you prefer a spline-based generalized additive model over gradient boosting?
  • How do you choose the number and placement of spline knots, and how does that compare with how a tree picks its thresholds?