Databricks Machine Learning Associate Question 176
Single answerYou are building a machine learning model to predict the category of customer feedback based on survey data. One of the categorical features, 'Customer Region', has missing values. When would replacing these missing values with the mode of the feature be an appropriate approach?
- A
The feature 'Customer Region' has a small number of distinct categories, and the distribution is highly imbalanced.
- B
The feature 'Customer Region' has a large number of distinct categories, and the missing values are randomly distributed.
- C
The feature 'Customer Region' is a numeric feature, and the missing values are randomly distributed.
- D
The feature 'Customer Region' has a small number of distinct categories, and the missing values are randomly distributed.
Show answer and explanation
Correct answer: D
Explanation
Replacing missing values with the mode is an effective strategy for categorical features with a small number of distinct categories, especially when the missing values are randomly distributed. This approach works well in such scenarios because it maintains the most frequent value without overcomplicating the data or introducing additional bias. However, it may not work well for features with a large number of categories or imbalanced distributions, as it could distort the underlying data patterns.
- A. Incorrect.
Replacing missing values with the mode is not ideal when the distribution is highly imbalanced, as it may introduce bias by over-representing the majority class.
- B. Incorrect.
Replacing missing values with the mode for a feature with a large number of distinct categories is not recommended because it may not effectively capture the inherent patterns in the data.
- C. Incorrect.
Mode imputation is specifically used for categorical features, not numeric features. Numeric features typically require other strategies such as mean or median imputation.
- D. Correct.
When the feature has a small number of distinct categories and the missing values are randomly distributed, replacing them with the mode is appropriate because it preserves the dominant pattern in the data without introducing significant bias.