Home / ML Associate practice test / Data Processing / Question

Databricks Machine Learning Associate · free practice question

A team is building a gradient boosting classifier (GBTClassifier in Spark MLlib) to predict customer churn. The dataset includes a zip_code column with 500…

Exam-style question on Data Processing from the free ML Associate practice test, with the answer and a full explanation below.

Updated November 10, 2026

Data Processing

A team is building a gradient boosting classifier (GBTClassifier in Spark MLlib) to predict customer churn. The dataset includes a zip_code column with 500 distinct values. A colleague suggests one-hot encoding zip_code before training. Which statement best explains why one-hot encoding is potentially problematic for this specific combination of feature and model type?

  1. AOne-hot encoding is in fact required for GBTClassifier rather than problematic: tree splits are linear operations that process binary indicator columns, and without encoding the model raises a type error on categorical integer indices during training
  2. BOne-hot encoding zip_code yields a binary matrix of rank 499, below the number of training examples, and the matrix factorization step inside GBTClassifier then fails with a singular matrix exception during the gradient computation phase of training
  3. COne-hot encoding zip_code yields 499 sparse binary columns, and for trees each split then isolates a single zip code instead of grouping related areas while searching hundreds of near-constant columns; integer or target encoding gives better trees here
  4. DOne-hot encoding zip_code yields exact 0/1 columns, and gradient boosting needs features standardized with StandardScaler before training, which would turn the 0 values into negative z-scores that break the binary constraints GBTClassifier expects
  5. EOne-hot encoding zip_code maps null or unknown categories to an all-zero sparse vector, and boosted trees treat that vector as a distinct category at each split, adding leaf nodes for the null group and inflating tree depth beyond what is needed
Answer & explanation

Correct answer: C

WHY C: High-cardinality one-hot encoding (500 categories -> 499 binary columns) causes three compounding problems for tree-based models: (1) massive feature space expansion slows training and increases memory usage, (2) each binary split can only separate 'zip code X vs. all others' rather than grouping geographically similar areas, reducing the information gain of each split, and (3) most columns are near-zero-variance, so trees waste split evaluations on uninformative features. Integer label encoding or target encoding typically works better for tree models with high-cardinality categorical features.

WHY NOT A: Tree-based models do not require one-hot encoding; GBTClassifier can operate on integer-encoded categorical features and does not raise type errors on them.

WHY NOT B: Decision trees do not perform matrix factorization or inversion; rank deficiency is a concern for linear regression, not for tree ensembles.

WHY NOT D: Tree-based models are scale-invariant and do not require feature standardization; StandardScaler is irrelevant for gradient boosting.

WHY NOT E: Null handling and OHE are independent issues; the all-zero vector does represent the dropped category in OHE, but that does not cause trees to over-allocate leaf nodes to null rows.

Take the full ML Associate practice test free →

Would you pass today?

This question is one of 45 in the free, timed Databricks Machine Learning Associate practice test. Take it and get a section-by-section score.

Start the free test →