Databricks Machine Learning Associate Question 195
Select 3Why can one-hot encoding categorical features be inefficient when used with tree-based models?
- A
One-hot encoding can lead to high memory usage for categorical features with many unique values.
- B
Tree-based models can inherently handle categorical data without requiring one-hot encoding.
- C
One-hot encoding creates sparse data, which can make it harder for tree-based models to find meaningful splits.
- D
One-hot encoding often improves the performance of tree-based models, making it the most efficient encoding method.
- E
Tree-based models rely on numerical splits and do not benefit from dummy variables introduced by one-hot encoding.
Show answer and explanation
Correct answers: A, B, C
Explanation
One-hot encoding is often inefficient for tree-based models due to the increased memory usage from the high dimensionality of categorical features with many unique values. Additionally, tree-based models like Decision Trees or Gradient Boosted Trees are capable of handling categorical data directly, often without requiring one-hot encoding. Sparse data created by one-hot encoding can make it harder for the model to find meaningful splits, further reducing efficiency.
- A. Correct.
Correct: One-hot encoding creates a separate binary column for each category, which can result in high memory usage when there are many unique categories.
- B. Correct.
Correct: Many tree-based models, such as Decision Trees or Gradient Boosted Trees, can directly handle categorical data using techniques like categorical splits, making one-hot encoding unnecessary.
- C. Correct.
Correct: One-hot encoding creates sparse datasets with many zeroes, which can reduce the efficiency of tree-based models in finding optimal splits.
- D. Incorrect.
Incorrect: While one-hot encoding might work for some models, it is not necessarily the most efficient method for tree-based models, as they can handle categorical data more effectively without it.
- E. Incorrect.
Incorrect: While tree-based models do rely on numerical splits, dummy variables from one-hot encoding can still be used, although this is not the most efficient approach.