<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shubham Pandey on Medium]]></title>
        <description><![CDATA[Stories by Shubham Pandey on Medium]]></description>
        <link>https://medium.com/@shubhampandey426?source=rss-a0a87323331d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-cENqma02JjT1v0h</url>
            <title>Stories by Shubham Pandey on Medium</title>
            <link>https://medium.com/@shubhampandey426?source=rss-a0a87323331d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:59:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shubhampandey426/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Spotting the Unusual: A Guide to Outlier Detection ( Part-1)]]></title>
            <link>https://medium.com/@shubhampandey426/spotting-the-unusual-a-guide-to-outlier-detection-part-1-1d7b442959bf?source=rss-a0a87323331d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d7b442959bf</guid>
            <category><![CDATA[model-performance]]></category>
            <category><![CDATA[outliers]]></category>
            <category><![CDATA[outlier-detection]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Shubham Pandey]]></dc:creator>
            <pubDate>Sat, 26 Aug 2023 06:18:17 GMT</pubDate>
            <atom:updated>2023-08-26T06:18:17.275Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is an outlier?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5iygpVkZ28vONFMNoADOrQ.png" /></figure><p>Hey everyone,</p><p>Today, let’s delve into the concept of outliers and uncover their impact. To make it more relatable, consider this well-known scenario.</p><p>Imagine you compile the salaries of your ten close friends. Now, add the salary of none other than Sundar Pichai to this mix. Calculating the average of this entire group, you’d likely end up with a substantial figure. While I won’t perform the exact calculation here, you can surely imagine the magnitude.</p><p>Now, take a moment to reflect. Does it make sense to claim that you and your friends’ salaries are roughly in line with this calculated average? In all likelihood, the answer is a resounding “no.” The reason behind this mismatch is rather clear: Sundar Pichai’s salary acts as an outlier within our dataset.</p><p>Outliers, such as Mr. Pichai’s exceptional salary in this case, possess the potential to significantly distort the overall picture. They can skew averages, making them seem far from what’s typical for the majority. This is why it’s crucial to identify and address outliers appropriately in data analysis.</p><p>Remember, outliers aren’t just about numbers; they carry emotions and stories that influence our perceptions. Understanding their impact can help us make more informed interpretations of data.</p><blockquote>So now you understand what is outlier let&#39;s see why treating them properly is important.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*kbU1Cbs0gbrYdKQErFrFyQ.png" /></figure><h3><strong>Problems caused by outliers?</strong></h3><p><strong>Skewed Statistical Analysis:</strong> Outliers can significantly affect the mean, variance, and other statistical measures, leading to skewed analysis and inaccurate conclusions.</p><p><strong>Improve Interpretability:</strong> Outliers can introduce noise to our analysis, making it difficult to interpret the relationship between the variables.</p><p><strong>Model Assumptions:</strong> Many statistical and ML models assume the data is normally distributed, with the presence of outliers, data is skewed to either side. Violating these assumptions can affect our model performance.</p><p><strong>Visualization Issue:</strong> Ignoring these outliers can mess up our reports and Visualization, not showing the real trend correctly. Here’s a tip: give it a shot and make a histogram using data that has outliers.</p><blockquote>Now lets move to the next phase and understand how to Detect Outliers.</blockquote><h3><strong>Outlier Detection?</strong></h3><p><strong>Visualization Techniques</strong></p><ol><li><strong>Box Plot:</strong> Box plots (box-and-whisker plots) provide a visual representation of the distribution of data. Outliers can be identified as individual points beyond the “whiskers” of the box plot.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*ffgzfyhOIu1tQZcrB-B6tA.png" /></figure><pre># Import libraries for visualization<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br><br># Ploting Boxplot<br>plt.figure(figsize=(10,5))<br>sns.boxplot(data=data,x=&#39;SalePrice&#39;,palette=[&quot;skyblue&quot;, &quot;lightgreen&quot;, &quot;orange&quot;])<br>plt.plot()</pre><p>2. <strong>Scatter Plots:</strong> Scatter plots are useful for visualizing relationships between two variables. Outliers can appear as data points that are far away from the main cluster of points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*xOYsJGY4DYTXskxJDcP2Dw.png" /></figure><pre>#Ploting Scatter plot<br><br>plt.figure(figsize=(10,5))<br>sns.scatterplot(data=data,x=&#39;SalePrice&#39;,y=&#39;LotArea&#39;)<br>plt.plot()</pre><p><strong>Histograms:</strong> Histograms show the frequency distribution of a single variable. Unusual peaks or gaps in the histogram might indicate the presence of outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*HqppHTaWJ1k2emN6tNodgQ.png" /></figure><pre># Ploting Boxplot<br>plt.figure(figsize=(10,5))<br>sns.histplot(data=data,x=&#39;SalePrice&#39;)<br>plt.plot()</pre><h3>Other Methods</h3><ol><li><strong>IQR Method</strong></li></ol><p>The Interquartile Range (IQR) method is one of the most common outlier detection methods in data mining. The IQR is calculated as the difference between the dataset’s third quartile (Q3) and the first quartile (Q1). Q1 is the value at the 25th percentile, and Q3 is at the 75th percentile.</p><p>Outliers can be detected by identifying data points that fall below Q1−1.5∗IQR or above Q3+1.5∗IQR. These points are considered significantly different from most of the data and can be labeled as outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*tRkItRVu4ZlFd7Gwtm-zLw.png" /></figure><pre># Finding Quartile values<br>Q1=np.percentile(data[&#39;SalePrice&#39;],25) <br>Q3=np.percentile(data[&#39;SalePrice&#39;],75)<br>IQR=Q3-Q1<br>lower_outlier=Q1-1.5*IQR<br>upper_outlier=Q3+1.5*IQR<br><br># DataFrame of Outliers Data<br>data[data[&#39;SalePrice&#39;]&gt;upper_outlier]</pre><p><strong>2. Z Score</strong></p><p>People unfamiliar with Z score can follow the link: <a href="https://www.statisticshowto.com/probability-and-statistics/z-score/">https://www.statisticshowto.com/probability-and-statistics/z-score/</a></p><p>The Z-Score of a point is basically the measure that tells us how many standard deviations is the point from the mean of the data.</p><p>Z-score is calculated with the formula ( Z-score= x-mean/ S.D)</p><p>To detect outliers we can put a threshold between (2.5–3) usually 2.8 is a good option, the data points beyond the threshold are the outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Cy83F-x161QzuUcX2zUypQ.png" /></figure><pre>threshold_value=3<br><br>#Finding mean and standard deviation<br>mean=np.mean(data[&#39;SalePrice&#39;])<br>stand=np.std(data[&#39;SalePrice&#39;])<br><br>#Adding a z-score column in our dataframe <br>data[&#39;Z_score&#39;]=(data[&#39;SalePrice&#39;]-mean)/stand<br><br>outlier_data=data[data[&#39;Z_score&#39;]&gt;threshold_value]</pre><p>So Far we have covered Outlier detection in the following part you will learn how to treat these outliers to increase our model efficiency and performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d7b442959bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>