Outliers
An outlier is a value that is unusually far away from most other values in a dataset. Outliers can sometimes represent mistakes, but they can also represent real and important situations.
An outlier is a value that is very different from most other values.
For example, if most customers are between 20 and 60 years old and one value is 250, that value is far away from the others and should be investigated.
A Simple Example
Suppose we have the following customer ages:
Most values are between 24 and 34, while 95 is much farther away from the rest.
Therefore, 95 may be considered an outlier in this dataset.
Outlier vs Incorrect Data
This is one of the most important differences to understand.
Probably a data-entry or data-quality problem.
Unusual, but it could be a real value.
An incorrect value is wrong. An outlier is simply unusual.
Sometimes an outlier is incorrect, but sometimes it is completely valid.
A Real Example: House Prices
Imagine a dataset containing house prices:
Most houses are between ₹40 lakh and ₹55 lakh. A ₹5 crore house is very different from the others.
That makes ₹5 crore an outlier in this particular dataset.
But that does not mean the ₹5 crore value is wrong. It could be a genuine luxury property.
Why Can Outliers Matter?
Some machine learning models can be strongly affected by extreme values.
For example, suppose we calculate the average income of these customers:
Most customers earn between ₹30,000 and ₹45,000, but one customer earns ₹10,00,000.
That extreme value can pull the average upward and make the dataset look different from what most customers actually look like.
Where Do Outliers Come From?
An outlier can have different causes.
This is why we should investigate an outlier before deciding what to do with it.
Should We Remove Outliers?
Not automatically.
Example: Age = 250 because of a typing mistake.
Example: A genuine customer with very high income.
Removing a real observation simply because it is unusual can make the dataset less representative of reality.
Simple Real-World Example
Imagine an e-commerce company wants to analyze customer spending.
Arun's spending is dramatically higher than the others.
We should investigate why. Perhaps Arun is a business customer who genuinely spends ₹5,00,000 every month.
If that is true, removing Arun just because he is unusual would be a mistake.
Outliers Depend on the Dataset
A value can be an outlier in one dataset but completely normal in another.
₹10 lakh may be an extreme value.
₹10 lakh may not be unusual.
An outlier is always evaluated in context. There is no universal number that automatically means "outlier."
Outlier Does Not Mean Wrong.
An outlier is simply a value that is unusually different from most other values. Investigate it first. Remove or correct it only when there is a good reason.
What Should You Do?
Most customers spend ₹2,000–₹10,000 per month. One customer spends ₹2,00,000.
First investigate the value. It may be a genuine high-spending customer or it may be a data-entry mistake. Only after understanding the reason should you decide whether to keep, correct, or remove it.