Using the IQR rule, which values of a feature are treated as outliers?
- Exam domain
- Data Processing20% of the exam
- Difficulty
- Medium
- In this mock
- 10 questions on this domainPractise this domain
Why the exam asks this
Data Processing (20% of the exam)
Objective in the exam guide: Remove outliers from a Spark DataFrame based on standard deviation or IQR
Removing outliers by standard deviation or IQR is named.
Why B is the answer
Values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQR
The IQR rule flags values more than 1.5 interquartile ranges below the first quartile or above the third. A standard-deviation rule commonly uses mean ± 3σ.
Remember: IQR fences at 1.5 × IQR.
How it works
IQR and standard deviation give outlier thresholds.
In detail
- IQR = Q3 − Q1.
- Fences at 1.5 × IQR.
Every option, checked
Knowing why each wrong option fails is how you rule it out on exam day.
A. The top and bottom 1% regardless of spreadWrong
Fixed percentiles ignore spread.
B. Values below Q1 − 1.5 × IQR or above Q3 + 1.5 × IQRRight
IQR fences at 1.5 × IQR.
C. Any value above the mean, since those pull the distribution upwardWrong
Half of normal data is above the mean.
D. Values outside one standard deviation of the medianWrongMost tempting
One standard deviation flags too much.
Why it tempts: It mixes the two rules.
Use case
An illustrative scenario, not a real incident.
Illustrative: house sizes above Q3 + 1.5 × IQR are removed before training a price model.
See it in different ways
flowchart LR S0["approxQuantile Q1 and Q3"] --> S1["IQR = Q3 − Q1"] --> S2["Compute fences"] --> S3["Filter rows"]
How to read this chart
- Read it in order: approxQuantile Q1 and Q3, then IQR = Q3 − Q1, then Compute fences, then Filter rows.
flowchart TD
Q{"Is the feature roughly normal?"}
Q -->|"Yes"| A0["Mean ± 3 standard deviations"]
Q -->|"Skewed"| A1["IQR fences"]How to read this chart
- At "Is the feature roughly normal?": if "Yes", go to "Mean ± 3 standard deviations"; if "Skewed", go to "IQR fences".