Feature engineering and preprocessing · insight-0104
Use RobustScaler when a few extreme values distort mean-and-variance scaling, then decide about the extremes separately
- Evidence type
- documented fact
- Difficulty
- easy
- Roles
- Data scientist, Data analyst, ML engineer
- Industries
- aviation
Summary: situation, action, reason, boundary
Situation
A scaled feature has a handful of huge values, such as a 10x passenger outlier or a corporate group booking.
Action
Switch to RobustScaler (median and interquartile range) for that branch, and in parallel diagnose each extreme as error, rare truth or regime change.
Reason
Median and quantile ranges are barely moved by a few extreme points, while mean and standard deviation are pulled towards them.
Boundary
Linear, kernel and distance models with heavy-tailed or contaminated numeric features.
Symptom or risk
StandardScaler squeezes ordinary rows into a narrow band, so distance and penalty models lose resolution where most data lives.
Exceptions
RobustScaler does not remove outliers; they remain extreme after scaling and can still dominate squared-error losses.
Trade-offs
Clipping at training quantiles bounds influence but hides genuinely large cases you may need to price or flag.
Pitfalls
Treating scaling as outlier handling, or computing clip limits on the full dataset rather than the training fold.
Example
In the synthetic flight_day_raw table, the 10x passengers row is a data error to fix, not a value to rescale.
Lessons and concepts
Claims and their sources
Mean/variance scaling can work poorly with many outliers; RobustScaler uses more robust estimates of center and range.