Series Data Voyage Training Log

~1 min read

Deciding Whether to Drop or Keep Outliers

Spotting outliers visually with boxplots and scatter plots on House Prices data, computing bounds with IQR, deciding 'remove or clip', and comparing distributions before and after.

TrainingDataPreprocessing

An Outlier Is Not a "Wrong Value"

In this exercise I first changed how I look at outliers. An outlier isn't necessarily an error to delete but a signal to first ask why it stands out.

Look First

  • Used describe() to find variables with a long right tail, SalePrice being the classic case
  • Drew boxplots for SalePrice, LotArea, GrLivArea, GarageArea each
  • Used a GrLivArea vs SalePrice scatter to find "houses that are large yet oddly cheap"

Computing Bounds with IQR

Q1 = df["SalePrice"].quantile(0.25)
Q3 = df["SalePrice"].quantile(0.75)
IQR = Q3 - Q1
lower = Q1 - 1.5 * IQR
upper = Q3 + 1.5 * IQR

I computed the count and share of rows outside this range. I repeated the same procedure across several area variables to make it routine.

Remove vs Clip

Choosing between removing and clipping was the core decision of this exercise. Removing discards the outlier rows entirely, so there is less data but it is clean. Clipping squeezes values to the boundary, so the row count stays and only the extremes are tempered. Which to choose depended on what I wanted to see in the data. I put the before and after distributions side by side and checked the impact.

Takeaway

Key point

Behind outliers like "large yet cheap houses" there is often an explainable story. The habit of glancing at a scatter plot before mechanically deleting carried over into EDA next.