How does a decision tree search for the best threshold split on a continuous feature?

Quick Overview

Asks how a decision tree chooses the threshold for a split on a numeric feature. Tests whether you can explain how candidate thresholds are chosen and evaluated efficiently, what the search costs per feature, and which speedups real implementations use.

How does a decision tree search for the best threshold split on a continuous feature?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does a decision tree search for the best threshold split on a continuous feature? Describe the procedure at a single node for one feature, how expensive it is, and the shortcuts real implementations use. ```hint Count the distinct partitions Every threshold between two adjacent sorted values produces the same left and right sets. How many genuinely different splits are there? ``` ```hint Avoid recomputing from scratch When the threshold moves past one sample, what changes in the left and right class counts, and how cheaply can you update the impurity? ``` ### What a Strong Answer Covers - How candidate thresholds are enumerated and which ones can be skipped. - How child impurities are computed efficiently as the threshold moves, for classification and for regression. - The time complexity per feature and per node, and which step dominates it. - Speedups used in practice and what each saves. - How the per-feature result is used to pick the split at the node and to grow the rest of the tree. ### Follow-up Questions - How would you handle missing values in the feature during this search? - How do histogram-based learners build the histograms for a child node cheaply? - How does the cost of growing a whole tree scale with depth, and how can an implementation avoid re-sorting at every node? - Why put the threshold at the midpoint between two values, and when does that choice change predictions?

Overview: Asks how a decision tree chooses the threshold for a split on a numeric feature. Tests whether you can explain how candidate thresholds are chosen and evaluated efficiently, what the search costs per feature, and which speedups real implementations use.

General logo
General
Nov 24, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How does a decision tree search for the best threshold split on a continuous feature?

Describe the procedure at a single node for one feature, how expensive it is, and the shortcuts real implementations use.

What a Strong Answer Covers Guidance

  • How candidate thresholds are enumerated and which ones can be skipped.
  • How child impurities are computed efficiently as the threshold moves, for classification and for regression.
  • The time complexity per feature and per node, and which step dominates it.
  • Speedups used in practice and what each saves.
  • How the per-feature result is used to pick the split at the node and to grow the rest of the tree.

Follow-up Questions Guidance

  • How would you handle missing values in the feature during this search?
  • How do histogram-based learners build the histograms for a child node cheaply?
  • How does the cost of growing a whole tree scale with depth, and how can an implementation avoid re-sorting at every node?
  • Why put the threshold at the midpoint between two values, and when does that choice change predictions?