Databricks Machine Learning Associate Question 535
Single answerYou are tasked with building a machine learning pipeline to predict customer churn. Your dataset includes a 'Region' column with values such as 'North', 'South', 'East', and 'West'. Which of the following statements is correct regarding the use of one-hot encoding for this column?
- A
One-hot encoding is appropriate because 'Region' is a categorical variable with no inherent order.
- B
One-hot encoding is not appropriate because it increases the dimensionality of the dataset, which is always undesirable.
- C
One-hot encoding is only appropriate if 'Region' has numerical values instead of strings.
- D
One-hot encoding is not appropriate because it assumes a linear relationship between the categories.
Show answer and explanation
Correct answer: A
Explanation
One-hot encoding is a standard preprocessing technique for nominal categorical variables, such as 'Region', which have no inherent order. It ensures that the machine learning model does not interpret any ordinal relationship between the categories. While one-hot encoding increases dimensionality, this trade-off is justified to properly represent categorical data in most cases.
- A. Correct.
This is correct because one-hot encoding is suitable for categorical variables without an inherent order, such as 'Region', to avoid introducing ordinal assumptions.
- B. Incorrect.
This is incorrect because while one-hot encoding does increase dimensionality, it is still the standard approach for handling nominal categorical variables.
- C. Incorrect.
This is incorrect because one-hot encoding is designed specifically for categorical variables, regardless of whether they are represented as strings or integers.
- D. Incorrect.
This is incorrect because one-hot encoding does not assume any linear relationship between the categories; it creates separate binary columns for each category.