Databricks Machine Learning Associate Question 526
Select 3You are working on a machine learning pipeline in Databricks to predict customer churn. Your dataset contains a column named 'Subscription_Type' with the categorical values 'Basic', 'Standard', and 'Premium'. You decide to use one-hot encoding on this column. Which of the following statements are true about the outcome of this transformation?
- A
The 'Subscription_Type' column will be replaced by three new columns, each representing one category.
- B
Each new column will contain binary values (0 or 1) indicating the presence of the corresponding category for a data point.
- C
One of the categories will be removed to avoid multicollinearity, and only two columns will be created.
- D
One-hot encoding is only applicable for numerical features and cannot be applied to categorical columns.
- E
One-hot encoding increases the dimensionality of the dataset.
Show answer and explanation
Correct answers: A, B, E
Explanation
One-hot encoding is a method used to convert categorical data into a format that can be provided to machine learning algorithms. It replaces the original column with multiple binary columns, each representing one category. While it increases the dimensionality of the dataset, it is widely used for handling categorical features. It does not inherently remove a category, as dummy encoding would, and it is specifically applicable to categorical data.
- A. Correct.
Correct: One-hot encoding replaces the original categorical column with as many columns as there are unique categories, each representing one category.
- B. Correct.
Correct: Each new column generated by one-hot encoding contains binary values, where 1 indicates the presence of the category and 0 indicates its absence.
- C. Incorrect.
Incorrect: One-hot encoding does not automatically remove one category to avoid multicollinearity; this is handled by techniques like dummy encoding or by explicitly dropping one column.
- D. Incorrect.
Incorrect: One-hot encoding is specifically designed for categorical features and can be applied to transform them into numerical representations.
- E. Correct.
Correct: One-hot encoding increases the dimensionality of the dataset by introducing additional columns for each unique category.