What is the difference between splitter='best' and splitter='random' in a scikit-learn decision tree?

Quick Overview

Asks how the best and random splitter options in a scikit-learn decision tree choose split thresholds and what that changes. Tests knowledge of greedy CART split search, training cost, the bias and variance effect of random thresholds, and how this connects to Extremely Randomized Trees.

What is the difference between splitter='best' and splitter='random' in a scikit-learn decision tree?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

scikit-learn's `DecisionTreeClassifier` and `DecisionTreeRegressor` take a `splitter` parameter. What is the difference between `splitter='best'` and `splitter='random'` in a scikit-learn decision tree? ```hint Compare the search Count how many thresholds each option tries for one feature at one node. Then ask what that extra randomness does to a single tree compared with an average of many trees. ``` ### What a Strong Answer Covers - How `'best'` searches thresholds for each considered feature and picks the split - How `'random'` draws thresholds, and that it still picks the best of the random candidates - The difference in training cost - The effect on bias, variance and correlation between trees, and the link to Extremely Randomized Trees - Where randomness enters even with `'best'` ### Follow-up Questions - How do Extra Trees differ from a random forest beyond the splitter? - Would you ever use `splitter='random'` on a single tree, and when? - How does `max_features` interact with each splitter? - Why does a threshold drawn uniformly between the node's min and max favor splits across wide gaps in the feature values?

Overview: Asks how the best and random splitter options in a scikit-learn decision tree choose split thresholds and what that changes. Tests knowledge of greedy CART split search, training cost, the bias and variance effect of random thresholds, and how this connects to Extremely Randomized Trees.

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

scikit-learn's DecisionTreeClassifier and DecisionTreeRegressor take a splitter parameter. What is the difference between splitter='best' and splitter='random' in a scikit-learn decision tree?

What a Strong Answer Covers Guidance

  • How 'best' searches thresholds for each considered feature and picks the split
  • How 'random' draws thresholds, and that it still picks the best of the random candidates
  • The difference in training cost
  • The effect on bias, variance and correlation between trees, and the link to Extremely Randomized Trees
  • Where randomness enters even with 'best'

Follow-up Questions Guidance

  • How do Extra Trees differ from a random forest beyond the splitter?
  • Would you ever use splitter='random' on a single tree, and when?
  • How does max_features interact with each splitter?
  • Why does a threshold drawn uniformly between the node's min and max favor splits across wide gaps in the feature values?