tensorturnBETA
Home › Data Cleaning & Analytics

Outlier Detection: How to Find Outliers in Your Data and Decide What to Do

To find outliers in data, start with robust univariate rules: flag values beyond the IQR fences (1.5 times the interquartile range outside the quartiles) and rows whose modified z-score exceeds 3.5, then use a multivariate method such as isolation forest when unusual combinations matter. TensorTurn runs IQR and modified z-score outlier analysis automatically on upload and ranks the most anomalous rows, so you see exactly which records are suspect before deciding whether to remove, cap or keep them.

What counts as an outlier

An outlier is an observation that sits far from the bulk of the data. That definition hides two very different things. Some outliers are errors: a typo that turns 45 into 450, a sensor that reports -9999 when it fails, a currency column mixing dollars and cents. Others are rare but real: a genuine enterprise customer among small accounts, a fraudulent transaction, a machine about to fail. Errors should be fixed or removed. Rare real cases are often the most important rows in the dataset. Detection methods only find unusual values; deciding which kind they are is a judgment call.

Outlier detection methods compared

MethodHow it worksBest forWeakness
IQR fencesFlags values below Q1 - k x IQR or above Q3 + k x IQR, with k = 1.5 (mild) or 3 (extreme)Quick, robust univariate screening of any numeric columnFlags many points in naturally skewed data; one column at a time
Z-scoreFlags values more than about 3 standard deviations from the meanRoughly normal data with few outliersOutliers inflate the mean and standard deviation, which can hide them (masking)
Modified z-scoreUses the median and median absolute deviation (MAD); flags |M| > 3.5Robust univariate detection even when outliers are presentStill one column at a time; MAD can be 0 for very repetitive columns
Isolation forestRandom trees isolate points; anomalies need fewer splitsMultivariate anomalies in larger tabular datasetsNeeds a contamination guess; less interpretable; requires training

The robust formulas in plain words

The interquartile range is the distance between the 25th percentile (Q1) and the 75th percentile (Q3), the span of the middle half of the data. The IQR rule draws a fence 1.5 IQRs below Q1 and 1.5 IQRs above Q3; anything outside is a mild outlier, and anything beyond 3 IQRs is an extreme one. Because quartiles barely move when a few wild values appear, the fences stay sensible even in dirty data.

The modified z-score, proposed by Iglewicz and Hoaglin, replaces the mean with the median and the standard deviation with the median absolute deviation: M = 0.6745 x (value - median) / MAD. Values with an absolute M above 3.5 are flagged. The classic z-score uses the mean and standard deviation, which the outliers themselves pull around, so a dataset with several large errors can end up with none of them crossing |z| > 3. The modified version avoids that masking effect.

Univariate vs multivariate outliers

Some records are only strange in combination. A height of 150 cm is normal and a weight of 95 kg is normal, but a 4-year-old with both is not. Univariate rules will never catch that row. Multivariate methods such as isolation forest, local outlier factor or a distance measure in a scaled feature space look at all columns together. A good workflow is to clean obvious univariate errors first, because they distort multivariate methods, and then run a multivariate pass if unusual combinations matter for your problem. If finding anomalies is the goal itself, such as fraud or defect detection, treat it as a modeling task rather than a cleaning step.

When to remove outliers and when to keep them

Common mistakes

How to detect outliers on TensorTurn

Start building free

Frequently asked questions

What is the best way to find outliers in data?

For a single numeric column, the IQR rule and the modified z-score are the most robust starting points because they rely on quartiles and medians that outliers barely affect. For unusual combinations across several columns, use a multivariate method such as isolation forest.

What is the 1.5 IQR rule?

It flags any value more than 1.5 times the interquartile range below the first quartile or above the third quartile. Values beyond 3 times the IQR are usually called extreme outliers.

Is z-score or IQR better for outlier detection?

IQR is usually safer because it does not assume normality and is not distorted by the outliers themselves. The plain z-score works on roughly normal data, and the modified z-score based on the median is a robust alternative to both.

Should I remove outliers before training a model?

Remove or fix values that are clearly errors, but keep rare real cases the model will face in production, especially when they are the thing you want to predict. Capping or transforming heavy tails is often better than deleting rows.

Can TensorTurn show me which rows are outliers?

Yes. Alongside per-column IQR fences, TensorTurn ranks the most anomalous rows by modified z-score so you can inspect the specific records, then remove or fix them in the AI data editor.