How would you handle missing data for a numerical feature in a dataset before training a machine learning model?
- Ignore missing data, it won't affect the model
- Remove the rows with missing data
- Replace missing values with a random value
- Replace missing values with the mean of the feature
Handling missing data is crucial. Replacing missing values with the mean of the feature is a common practice as it retains data and doesn't introduce bias, especially in numerical features. Removing rows or using random values can lead to loss of information or noise.
Loading...
Related Quiz
- How would you access the last element of a list stored in a variable named my_list?
- Which method is used to remove a key-value pair from a dictionary by specifying the key?
- During code review, you notice that a colleague has used a generic except block without specifying any exception. What potential issues might this lead to?
- Which Python method is executed when the context of a with statement is entered?
- If an elif block gets executed in a series of if, elif, and else blocks, what happens to the subsequent elif and else blocks?