Databricks Machine Learning Associate Question 516
Select 2You are working on a machine learning project to predict house prices. Your dataset contains missing values in the 'Lot Size' column, which is a continuous numerical feature. You are considering imputing these missing values using either the mean or median of the column. In which scenarios would imputing with the median be a better choice than imputing with the mean?
- A
The 'Lot Size' column has a skewed distribution with a few extreme outliers.
- B
The 'Lot Size' column has a normal (Gaussian) distribution without outliers.
- C
You want to ensure that the filled values do not create bias in the dataset when there are outliers.
- D
You are primarily optimizing for computational efficiency in handling missing values.
Show answer and explanation
Correct answers: A, C
Explanation
Imputing with the median is advantageous when the data contains skewness or extreme outliers because it is a more robust measure of central tendency that is not influenced by extreme values. The mean, on the other hand, is sensitive to outliers and is more appropriate for normally distributed data without outliers. Understanding the nature of your data is crucial in selecting the right imputation strategy, as it can significantly impact the performance of your machine learning model.
- A. Correct.
The median is more robust to skewed distributions and extreme outliers than the mean. Hence, it is a better choice in this scenario.
- B. Incorrect.
The mean is preferable when the data follows a normal distribution without outliers because both measures are similar in such cases.
- C. Correct.
The median helps mitigate bias caused by outliers, making it a better imputation strategy when outliers are present.
- D. Incorrect.
While the median may be slightly less computationally efficient than the mean, this is rarely a significant factor in most real-world scenarios.