Databricks Machine Learning Associate Question 174
Single answerIn which of the following scenarios is it most appropriate to replace missing values with the mode value in a dataset when building a machine learning model?
- A
When the missing values are in a categorical feature with a small number of unique categories
- B
When the missing values are in a numerical feature with a normal distribution
- C
When the missing values are in a categorical feature with a high level of cardinality
- D
When the missing values are in a numerical feature that is highly skewed
Show answer and explanation
Correct answer: A
Explanation
Replacing missing values with the mode is appropriate when dealing with categorical features that have a small number of unique categories. The mode effectively represents the most frequent category, ensuring that the imputation is aligned with the feature's distribution. Other scenarios like numerical features or high cardinality categorical features require different strategies to avoid introducing bias or misrepresentation.
- A. Correct.
Replacing missing values with the mode is most effective for categorical features with a small number of unique categories, as the mode represents the most frequently occurring value and helps preserve the feature's distribution.
- B. Incorrect.
Replacing missing values with the mode is not suitable for numerical features with a normal distribution; using the mean or median would be more appropriate in such cases.
- C. Incorrect.
For categorical features with high cardinality (many unique values), replacing missing values with the mode may introduce bias, as the mode may not represent the feature's diversity.
- D. Incorrect.
Replacing missing values with the mode is not applicable to numerical features, especially those that are highly skewed. The median is usually a better choice in such cases.