PROFESSIONAL-MACHINE-LEARNING-ENGINEER · Question #73
While conducting an exploratory analysis of a dataset, you discover that categorical feature A has substantial predictive power, but it is sometimes missing. What should you do?
The correct answer is D. Add an additional class to categorical feature A for missing values. Create a new binary feature. To handle missing values in an important categorical feature, create a distinct category for missingness and a binary indicator feature to signal its absence.
Question
Options
- ADrop feature A if more than 15% of values are missing. Otherwise, use feature A as-is.
- BCompute the mode of feature A and then use it to replace the missing values in feature A.
- CReplace the missing values with the values of the feature with the highest Pearson correlation
- DAdd an additional class to categorical feature A for missing values. Create a new binary feature
How the community answered
(41 responses)- A5% (2)
- B12% (5)
- C2% (1)
- D80% (33)
Why each option
To handle missing values in an important categorical feature, create a distinct category for missingness and a binary indicator feature to signal its absence.
Dropping a feature with substantial predictive power is generally undesirable, as it discards valuable information even if a significant percentage of values are missing.
Imputing with the mode for a categorical feature treats missing values as if they were actually the mode, which can introduce bias and lose the crucial information that the value was originally missing.
Replacing missing categorical values with values based on Pearson correlation with another feature is inappropriate, as Pearson correlation measures linear relationships between numerical variables, not directly for categorical imputation.
Adding a specific 'missing' class to categorical feature A allows the model to learn a distinct relationship for instances where the value is absent, preserving its predictive power. Creating a new binary feature (e.g., 'is_A_missing') explicitly signals to the model when the original value was missing, providing additional valuable information.
Concept tested: Handling missing categorical data
Source: https://scikit-learn.org/stable/modules/impute.html#imputing-missing-values-with-additional-data
Topics
Community Discussion
No community discussion yet for this question.