Databricks Machine Learning Associate Question 190
Select 3You are tasked with preparing a dataset for a machine learning model in Databricks. The dataset contains a categorical column named 'Region' with values 'North', 'South', and 'East'. You decide to apply one-hot encoding to this column. Which of the following statements about the one-hot encoding process are correct?
- A
One-hot encoding creates a separate binary column for each unique value in the 'Region' column.
- B
The original 'Region' column will be replaced by the newly created one-hot encoded columns.
- C
One-hot encoding is suitable for handling both categorical and numerical features.
- D
After one-hot encoding, the dataset will have three new columns named 'Region_North', 'Region_South', and 'Region_East'.
- E
One-hot encoding can introduce multicollinearity if all the new columns are included in the model.
Show answer and explanation
Correct answers: A, B, D
Explanation
One-hot encoding is a common technique used to convert categorical variables into a format that can be provided to machine learning algorithms to improve their performance. It creates new binary columns for each unique category and replaces the original column. In this case, the 'Region' column would be converted into three binary columns: 'Region_North', 'Region_South', and 'Region_East'.
- A. Correct.
Correct. One-hot encoding converts each unique category in the 'Region' column into a separate binary column.
- B. Correct.
Correct. One-hot encoding replaces the original categorical column with the newly created binary columns.
- C. Incorrect.
Incorrect. One-hot encoding is specifically designed for categorical features, not numerical features.
- D. Correct.
Correct. The new columns created by one-hot encoding are typically named by combining the original column name with the unique category values, e.g., 'Region_North'.
- E. Incorrect.
Incorrect. One-hot encoding avoids multicollinearity because only one column is active (set to 1) at a time for any given row.