How do you choose a strategy for handling outliers?
Role: Data Scientist
Category: Statistics & Math
Difficulty: medium
Interview Round: Other
Once you've identified outliers, what are the different strategies for handling or treating them, and what are the pros and cons of removing, capping/winsorizing, transforming, imputing, or keeping them and using robust methods?
```hint Start with where the value came from
Before picking a fix, ask what produced the extreme value. The right option for a typo may be the wrong one for a rare but real event.
```
```hint Count the cost of each option
For every strategy, look at what it gives up: rows you lose, values you invent, or a change in what the numbers mean.
```
### What a Strong Answer Covers
- How the cause of the outlier and the goal of the analysis drive the choice
- A real advantage and a real drawback for each of the five strategies
- Concrete robust alternatives and where they stop helping
- Practical safeguards, such as fitting thresholds on training data only and checking results with and without the treatment
### Follow-up Questions
- How would you choose the winsorizing percentile, and how do you keep it from leaking information from test data into training?
- In an A/B test on revenue per user, a few very large spenders dominate the variance. Which treatment would you use, and how does it change what you are estimating?
- When is a log transform the wrong choice for a skewed feature?
- How would you handle outliers in the target of a regression model differently from outliers in a feature?
Overview: Asks how to treat outliers once they are found, comparing removal, capping or winsorizing, transformation, imputation and robust methods. It tests whether you can weigh the bias and information loss of each option and pick a treatment that fits the source of the extreme value.