Databricks Machine Learning Associate Question 522
Select 3A data scientist is working with a dataset in Databricks that contains missing values in a column representing numerical data (e.g., 'age'). They decide to impute the missing values. Which of the following methods would be appropriate to fill the missing values in the column to maintain consistency in the dataset?
- A
Replace missing values with the mode of the column
- B
Replace missing values with the mean of the column
- C
Replace missing values with the median of the column
- D
Replace missing values with a random value within the range of the column
- E
Remove all rows containing missing values in the column
Show answer and explanation
Correct answers: A, B, C
Explanation
Imputing missing values with the mode, mean, or median is a standard practice in machine learning to handle missing data. These methods preserve the dataset's structure and statistical properties while minimizing the impact of missing values. Using a random value introduces noise, and removing rows with missing values is not an imputation method but rather a data reduction technique.
- A. Correct.
The mode can be used to impute missing values if the most frequent value logically represents the missing values for the column.
- B. Correct.
The mean is a standard approach to impute missing values for numerical data, as it provides an average value for the dataset.
- C. Correct.
The median is another common approach to impute missing values, especially when the data contains outliers, as it is less sensitive to extreme values.
- D. Incorrect.
While imputing with a random value is technically possible, it is not a recommended approach as it introduces noise and inconsistency in the dataset.
- E. Incorrect.
Removing rows with missing values is not an imputation method. Instead, it reduces the size of the dataset and may lead to loss of valuable information.