Skip to content
RED SAGSkills
easyMachine Learning Engineer interview question

How do you handle missing values in a dataset before training a model?

What the interviewer wants to hear

  • First understand why values are missing (random or meaningful)
  • Simple imputation with median, mean or most frequent value
  • Add a missing-indicator feature when missingness carries signal
  • Fit imputers on training data only to avoid leakage
  • Some models such as gradient boosting handle missing values natively

Model answer

I start by asking why the values are missing. If a field is missing because a user skipped an optional step, the fact that it is missing may itself predict the target. If it is a logging bug, I fix the pipeline instead of patching the model. For numeric features I often impute the median, which is robust to outliers, and for categories I use the most frequent value or a separate "unknown" category. I usually add a binary indicator column so the model can learn from the missingness. All imputers are fitted only on the training split inside a pipeline, so validation and serving use the same learned values without leakage. Gradient boosting libraries can handle missing values natively, which is often the simplest option. If a column is mostly empty and adds little, I drop it.

Can you answer it under time pressure?

Take a timed easy round and get scored on every answer.

Start mock interview

More easy Machine Learning Engineer questions