<?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 Azarudeen on Medium]]></title>
        <description><![CDATA[Stories by Azarudeen on Medium]]></description>
        <link>https://medium.com/@ajan19?source=rss-6caa6a677d50------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*lEZQyxVc0uM8_3u96P4fAA.jpeg</url>
            <title>Stories by Azarudeen on Medium</title>
            <link>https://medium.com/@ajan19?source=rss-6caa6a677d50------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:39:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ajan19/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[Distance in Machine Learning]]></title>
            <link>https://medium.com/@ajan19/distance-in-machine-learning-78fa018fe5ee?source=rss-6caa6a677d50------2</link>
            <guid isPermaLink="false">https://medium.com/p/78fa018fe5ee</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Azarudeen]]></dc:creator>
            <pubDate>Wed, 19 Feb 2020 10:37:21 GMT</pubDate>
            <atom:updated>2020-02-20T06:38:13.794Z</atom:updated>
            <content:encoded><![CDATA[<h4>The Importance of distance measurement in Machine learning and its applications.</h4><p>Let’s say you want to hand over a parcel to your friend within the next hour. For that, You need to find the shortest distance to your friend’s place.</p><p>How can we find the best distance?</p><p><em>1) Find all possible ways to reach your friend’s place.</em></p><p><em>2) Calculate distance for each.</em></p><p><em>3) Select the best.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1P3SFMN8eo-23hkUy--W5A.png" /><figcaption><a href="https://www.google.com/maps">Google maps</a> find the shortest path for you.</figcaption></figure><p>In machine learning, our algorithms are trying to understand the pattern. There are some algorithms which use distance function for that. There are many methods to calculate the distance between two points P(x1, y1) and Q(x2, y2) in 2d-plane. Each is different from others and has its advantages and use cases.</p><p><em>Distance metrics</em> uses a distance function to find the distance between points or data points or elements in the dataset.</p><h4>Euclidean distance(L2 norm)</h4><p>This is one of the most used distance functions in machine learning.</p><blockquote><strong>Euclidean distance is the length of the line which connects two points.</strong></blockquote><p>When we don’t want to give more importance to outliers in our dataset we can use this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*NMEHTamDAmrZ1fRyDKuSvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*mFisalmbRLaR9XxJ2BUrmA.png" /><figcaption>Euclidian Distance</figcaption></figure><pre>import math</pre><pre>def euc_distance(x, y):<br>    d = 0<br>    for a, b in zip(x, y):<br>        d += (sum([(pow((a-b),2))]))<br>    return math.sqrt(d)</pre><pre>a = [1,2,4]<br>b = [3,4,6]<br>print(euc_distance(a,b))</pre><pre><strong>Result:<br>3.4641016151377544</strong></pre><h4>Manhattan Distance(L1 Norm)</h4><blockquote><strong>Manhattan distance is the sum of the absolute difference between data points.</strong></blockquote><p>If you want to give more importance to outliers we can use Manhattan distance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*04jKeZHu8KIkQxap9Poi2g.png" /></figure><p>For the above diagram, the Manhattan distance will be zero.</p><blockquote>|(2–2)| + |(2–2)| = 0</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*k6mesfRLOqpkKTkjZUwMFQ.png" /><figcaption>Manhattan Distance</figcaption></figure><pre>def man_distance(x, y):<br>    d = 0<br>    for a,b in zip(x,y):<br>        d += sum([abs(a-b)])<br>    return d<br>    <br>a = [1,2,4]<br>b = [3,4,6]<br>print(man_distance(a,b))</pre><pre><strong>Result:<br>6</strong></pre><h4>Chebyshev Distance</h4><p>It is the maximum of the absolute difference between two data points. We use it in chess.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*k6mesfRLOqpkKTkjZUwMFQ.png" /><figcaption>where i is 1 to n</figcaption></figure><pre>def chebyshev_distance(x, y):<br>    d = []<br>    for a,b in zip(x,y):<br>        d.append([abs(a - b)])<br>    return max(d)</pre><pre>a = [1,2,14]<br>b = [3,4,6]<br>print(chebyshev_distance(a,b))</pre><pre><strong>Result:<br>8</strong></pre><h4>Minkowski distance</h4><p>It is a distance measurement between two points in the <a href="https://en.wikipedia.org/wiki/Normed_vector_space">normed vector space</a>. It is a generalization of the Euclidean distance and the Manhattan distance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*XgveEnhei8AeIDb2BIoQXw.png" /><figcaption>Minkowski distance</figcaption></figure><p>When we change the value of p it will give different distance functions.</p><p>We get Manhattan when P = 1</p><p>We get Euclidian when P = 2</p><p>We get Chebyshev when P = ∞</p><h4>Cosine Distance</h4><p>We use cosine distance to find similarities between two sentences or documents. It measures the angle between two vectors. The result will be between 0 and 1. 1 means they are identical. 0 means they are different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*WiiNUo9Xft-6GGb73Xgtvw.png" /><figcaption>Cosine similarity</figcaption></figure><p>The formula for cosine similarity is derived from <a href="https://www.mathsisfun.com/algebra/vectors-dot-product.html">dot product</a>.</p><p><strong>a · b</strong> = |<strong>a</strong>| . |<strong>b</strong>| × cos(θ)</p><p>cos(θ) = <strong>a · b / </strong>|<strong>a</strong>| . |<strong>b|</strong></p><pre>def dot(x,y): <br>    return (sum(a*b for a,b in zip(x,y)))</pre><pre>def cosine_similarity(a,b):<br>    return dot(a,b) / ((math.sqrt(dot(a,a))) * (math.sqrt(dot(b,b))))</pre><pre>a = [1,2,12]<br>b = [3,4,6]<br>print(cosine_similarity(a,b))</pre><pre><strong>Result:<br>0.870602762070945</strong></pre><h4>Hamming Distance</h4><p>Hamming distance finds how different two attributes are. We use this on strings.</p><pre>def hamm_distance(x,y):<br>    d = 0;<br>    for a,b in zip(x,y):<br>        if a != b:<br>            d = d + 1<br>    return d</pre><pre>print(hamm_distance(&quot;Azarudeen&quot;, &quot;Azarudern&quot;))</pre><pre><strong>Result:<br>1</strong></pre><p>We are using distance functions in algorithms such as KNN, k-means. Cosine distance is used in text mining. There is another distance metric called <em>Mahalanobis Distance </em>which is used in multivariate space.</p><p>Happy Machine Learning :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78fa018fe5ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Equality vs Equity]]></title>
            <link>https://medium.com/@ajan19/equality-vs-equity-58bf9933d260?source=rss-6caa6a677d50------2</link>
            <guid isPermaLink="false">https://medium.com/p/58bf9933d260</guid>
            <category><![CDATA[equality]]></category>
            <category><![CDATA[equity]]></category>
            <category><![CDATA[philosophy]]></category>
            <dc:creator><![CDATA[Azarudeen]]></dc:creator>
            <pubDate>Fri, 07 Feb 2020 11:07:43 GMT</pubDate>
            <atom:updated>2020-02-07T11:49:30.928Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Equality — the state of being equal, especially in status, rights, and opportunities</blockquote><blockquote>Equity — the quality of being fair and impartial</blockquote><p>Equality might look simple. But achieving it requires a willingness to recognize, creating an equal space for everyone, and the ability to judge what is right. <strong>Not everyone needs the same amount of help. Some need more, some need less.</strong></p><p><strong>Without equity, we cannot achieve equality.</strong></p><h4>Why do we need to have equity in the first place?</h4><p>The philosopher <a href="http://elitovar.net/wp-content/uploads/2013/08/1981_DworkinEquality1.pdf">Ronald Dworkin</a> divide equality into two theories.</p><blockquote>Equality Of Welfare.<br>Equality Of Resources.</blockquote><p>The first method takes environmental factors into account where the second doesn’t.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*7-I4Ju_7D720WXZfylKfJA.png" /><figcaption>Source: <a href="https://www.diffen.com/difference/Equality-vs-Equity">Link</a></figcaption></figure><p>Let&#39;s say you have two kids. One is working in a big tech firm as a software engineer and she is planning to start her startup soon. Another one is working as a cashier in a supermarket and she is planning to start her supermarket soon. If you divide your resources evenly, It means you are following equality of resources. What is the downside of this? <strong>You are willingly ignoring the facts about the children. </strong>Using equality of welfare, You are dividing your resources unevenly.</p><p>Most governments in the world are following the equality of welfare. They try to recognize the difference between the parties involved. It can be race, gender, sexual orientation, or income. <strong>In short, The government recognizes factors that are not in their control.</strong></p><p>Take me as an example, If I was born in a country or time where children slavery is legal, I would have never had access to the resources which I have now.</p><p><strong>It is not because of people&#39;s inability they are not able to get success. It is because they are helpless.</strong></p><p><strong>Successful people are not successful because of their ability. </strong>Few who rebelled against this unreasonable world and tasted success. But, Most were able to taste success with the help of things that they don’t have control of. ex: the country where they born, their parents and their wealth, their parent&#39;s network, the color of their skin, religion of their parents.</p><h4>Why do we need to work towards creating an equal space for everyone?</h4><p>As “<a href="http://www.zpub.com/notes/br.html">Bertrand Russell</a>” said in “<a href="http://www.zpub.com/notes/idle.html">In Praise of Idleness</a>”</p><blockquote>Leisure is essential to civilization.</blockquote><blockquote>In the past, there was a small leisure class and a larger working class. It contributed nearly the whole of what we call civilization.</blockquote><p>Equality of welfare is essential. We cannot let people in the working-class for long. We need to move them to the leisure class. Inclusive growth of all will lead humans to higher places. When we create more people with more leisure time, our civilization will improve further by more invention.</p><p>How the government can make equal space for everyone.</p><blockquote>Hey man, our ancestors were not kind to you. They denied many rights to you because of your color, race, caste, or sexual orientation. I want to undo that. I want to give all the rights back to you. Take it, man.</blockquote><blockquote>If you cannot make it through this competitive world. Don’t worry. We will ensure that you get all your basic needs at least.</blockquote><blockquote>If your income is not sufficient for you to meet all your basic needs and your children&#39;s studies. Don’t worry, We will try our best to take care of your children’s studies.</blockquote><blockquote>Looks like you are not earning much. We will remove or reduce tax on your income.</blockquote><blockquote>Don’t worry because of your disability. We will reserve some of our jobs for you. We will create a law to ensure that everyone treats you equally in the society.</blockquote><p>Equality might look simple. But achieving it requires a willingness to recognize, creating an equal space for everyone, and the ability to judge what is right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*5JRvWa6Q6MlIrpluKe1JoQ.jpeg" /><figcaption>Source: <a href="https://www.diffen.com/difference/Equality-vs-Equity">Link</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58bf9933d260" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>