Why might a Random Forest underperform a regularized linear model on high-dimensional sparse data such as text?

Quick Overview

Asks why a random forest can trail a regularized linear model such as logistic regression on sparse, high-dimensional text features. Tests reasoning about how text signal is structured, how feature subsampling and regularization behave on sparse columns, and what to try when a tree model is still needed.

Why might a Random Forest underperform a regularized linear model on high-dimensional sparse data such as text?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

Why might a Random Forest underperform a regularized linear model on high-dimensional sparse data such as text? Assume a bag-of-words or TF-IDF representation with tens of thousands of columns. ```hint Shape of the signal Think about how evidence for a label such as sentiment is spread across words, and how many splits a tree needs to represent a sum of many small effects. ``` ```hint What one node sees At a node holding a few hundred documents, pick about the square root of the vocabulary size in random columns. How many of them are nonzero for those documents? ``` ### What a Strong Answer Covers - How the signal in text is structured and which model form matches it - What sparsity does to random feature subsampling and split quality - Overfitting from rare features when features far outnumber samples, and how L1/L2 penalties control it - Practical costs of forests on this data: training and inference time, model size, calibration - What to try if a tree model is still required ### Follow-up Questions - When would a tree ensemble beat logistic regression on text? - How does gradient boosting on sparse TF-IDF behave differently from a random forest on the same matrix? - Would setting `max_features` to all features fix the problem, and what would it cost? - How would you check whether the forest's predicted probabilities are miscalibrated, and how would you correct them?

Overview: Asks why a random forest can trail a regularized linear model such as logistic regression on sparse, high-dimensional text features. Tests reasoning about how text signal is structured, how feature subsampling and regularization behave on sparse columns, and what to try when a tree model is still needed.

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

Why might a Random Forest underperform a regularized linear model on high-dimensional sparse data such as text? Assume a bag-of-words or TF-IDF representation with tens of thousands of columns.

What a Strong Answer Covers Guidance

  • How the signal in text is structured and which model form matches it
  • What sparsity does to random feature subsampling and split quality
  • Overfitting from rare features when features far outnumber samples, and how L1/L2 penalties control it
  • Practical costs of forests on this data: training and inference time, model size, calibration
  • What to try if a tree model is still required

Follow-up Questions Guidance

  • When would a tree ensemble beat logistic regression on text?
  • How does gradient boosting on sparse TF-IDF behave differently from a random forest on the same matrix?
  • Would setting max_features to all features fix the problem, and what would it cost?
  • How would you check whether the forest's predicted probabilities are miscalibrated, and how would you correct them?