nerdexam
Google

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.

Submitted by priya_blr· Apr 18, 2026Data processing and feature engineering

Question

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?

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)
  • A
    5% (2)
  • B
    12% (5)
  • C
    2% (1)
  • D
    80% (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.

ADrop feature A if more than 15% of values are missing. Otherwise, use feature A as-is.

Dropping a feature with substantial predictive power is generally undesirable, as it discards valuable information even if a significant percentage of values are missing.

BCompute the mode of feature A and then use it to replace the missing values in feature A.

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.

CReplace the missing values with the values of the feature with the highest Pearson correlation

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.

DAdd an additional class to categorical feature A for missing values. Create a new binary featureCorrect

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

#Missing data handling#Categorical features#Feature engineering#Data imputation

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-MACHINE-LEARNING-ENGINEER Practice