<?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 Rohan Roney on Medium]]></title>
        <description><![CDATA[Stories by Rohan Roney on Medium]]></description>
        <link>https://medium.com/@rohanroney98?source=rss-37b2facdf8f6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-aMzdX8y6zeoBkK6</url>
            <title>Stories by Rohan Roney on Medium</title>
            <link>https://medium.com/@rohanroney98?source=rss-37b2facdf8f6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:03:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohanroney98/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[Medium Blog Recommendation]]></title>
            <link>https://medium.com/almabetter/medium-blog-recommendation-8748285300ce?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8748285300ce</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[medium]]></category>
            <category><![CDATA[content-filtering]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[collaborative-filtering]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 07:22:21 GMT</pubDate>
            <atom:updated>2021-06-20T07:27:42.157Z</atom:updated>
            <content:encoded><![CDATA[<p>Contributors: <a href="https://medium.com/u/c18bfa9d4799">Aditya Gupta</a>, <a href="https://medium.com/u/a02a218eb47c">Bhanu Shahi</a>, <a href="https://medium.com/u/ad076944c596">Keerthana</a>, <a href="https://medium.com/u/37b2facdf8f6">Rohan Roney</a></p><p>Before we start we need to answer one very important question that is the very basis of this article.</p><p><strong>“ Why do we need a recommender system for Blogs? ”</strong></p><p><strong>Recommender systems</strong> are an important class of <strong>machine learning</strong> algorithms that offer “relevant” suggestions to users. Netflix, YouTube, Tinder, and Amazon are all examples of <strong>recommender systems</strong>.</p><p>Machine learning algorithms in recommender systems are typically classified into two categories — content-based and collaborative filtering methods although modern recommenders combine both approaches. Content-based methods are based on the similarity of item attributes and collaborative methods calculate similarity from interactions.</p><h3>Introduction</h3><blockquote><em>Let’s deep dive into the wonderful world of recommender systems with the help of medium blog recommendation system example.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cdZrog0DVgnPcDyb.gif" /></figure><p>To begin with, let’s start with the understanding of why medium needs a recommendation system for its blog.</p><ul><li><strong><em>There are around 18,00,000 new articles posted on Medium.com every month.</em></strong></li><li><strong>There are more than 2,50,000 writers on Medium currently.</strong></li></ul><p>and this number is increasing day by day. So for recommending the right stories to the right user is important to give the best experience to its reader.</p><p>Just like, the product recommendation system is there to help increase the revenue of the company, similarly, the Blog Recommendation system is to <strong>increase the popularity</strong> of the blog and give readers a <strong>good experience</strong>. In the following section, we will be considering the features that are available in the Medium platform to design our methodology.</p><h3>Data Definition</h3><p>As we understand that data is the most important raw material for building any machine learning model. So we also need to collect some data to proceed with the process of building a blog recommender system. Medium has data of each of their users either they are readers or writers. From that, we can extract some features that will serve our purpose.</p><ol><li><strong>User Data:-</strong> age, gender, location, user bio, number of followers.</li><li><strong>Content Data:-</strong> The title of the blog, published date-time, category, author, blog publication, tags, number of reactions, number of views, average reading time, predicted reading time</li><li><strong>User-Content Interaction:-</strong> number of claps, comments.</li></ol><p>Then there is a need to prepare these features according to our needs. So let’s start with the feature engineering part.</p><h3>Feature Engineering</h3><p>While building any machine learning model selecting the right set of features is a must and so with recommender systems. So, after collecting the User data, Content data, and User Content interaction we explored all the features and also engineered some new features by combining them.</p><p>We came up with the following features:</p><h4><strong>Title:</strong></h4><p>The<strong> title of the blog</strong> is an important factor on the medium which enables readers to find the blogs and makes them want to click through to read more. Creating headlines that catch visitors’ attention and spark their curiosity will encourage them to stick around longer and come back for more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*ygjwaTBcPBhP9yok.png" /><figcaption>Blog Title</figcaption></figure><p>We can extract the titles of each blog post and by applying relevant NLP techniques we can vectorize this feature and will further use it in our recommendation system.</p><h4><strong>Tags:</strong></h4><p>When it comes to getting the blogs noticed, <strong>tags</strong> are second most important after the title of the blog. Picking the right tags can make the difference between an article getting popular, and an article dying upon delivery. People generally write topic tags with respect to the content they have written and in medium, it is limited to 5 tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/0*4JbLwY-BocmoOM4m.png" /><figcaption>Tags</figcaption></figure><p>Tag is an important feature that can be used in this recommendation system for grouping articles w.r.t their respective tags.</p><h4><strong>Claps and Comments:</strong></h4><p>Claps and comments with respect to each and every blog reflect the Readers’ engagement with that blog and it basically reflects the popularity of a blog. We can use these two features to create a new feature called <strong>Readers reaction </strong>which will be the combination of these two features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/0*qJ3S2uV0SN0_rl_f.png" /><figcaption>Claps and Comments</figcaption></figure><h4><strong>Article Read Time and Average Reading Time:</strong></h4><p>Read time and member reading time are two important features of medium blogs.</p><ul><li><strong>Read Time</strong> or <strong>Article Read Time</strong>, appears at the top of any Medium article and is an estimate of how long it will take the reader to complete an article. It is based on the average reading speed of an adult (roughly 265 WPM). Medium takes the total word count of a post and translates it into minutes, with an adjustment made for images.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/0*xKIIcTNTYpukSD25.png" /><figcaption>Approximate Read Time</figcaption></figure><ul><li><strong>Average Reading Time</strong> is the Medium’s way of measuring how long a reader actively engages with an article. It is the average amount of time all readers (members and non-members) spent reading the blog.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/0*imThCfY32pm7_rD8.png" /></figure><p>We can combine these two features to generate a new feature called <strong>Readers engagement </strong>which is the ratio of average read time and Read time.</p><h3>Modelling of System</h3><h4>Popularity Recommendation:</h4><p>On medium, one can also see this trending on medium blog posts column. These recommendations completely based on claps, followers, views, average read time from which user-blog interaction scores can be derived and top6 blogs are recommended.</p><p>This recommendation doesn’t depend on the content user usually interacts with and the topics user follows. This is a general recommendation for everyone based on the trending blogs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y5O7cK2qmPW-sjid" /><figcaption>Popularity based Recommendation</figcaption></figure><h4>Personalized recommendation:</h4><p>These recommendations are different for every reader based on their interactions with the blogs on medium. We have broadly two types in this.</p><p>The first one is <strong>collaborative filtering</strong>. It is a method for obtaining automatic predictions (filtering) about a user’s interests by collecting preferences or taste information from a large number of users (collaborating). Finding patterns among multiple readers is what this entails in the context of the media.</p><p>If a group of articles excites the attention of multiple readers, it’s highly probable that a reader who begins reading one of these pieces will want to read the others in the group. As a result, suggestions are offered to comparable individuals based on the reading behaviour of other readers.</p><ol><li>Memory-based</li><li>Model-Based</li></ol><p><strong>Memory-based:</strong></p><p>This approach computes user similarities based on blogs they’ve interacted with (user-based approach) or computes blog similarities based on the users who’ve interacted with them (blog-based approach) (item-based approach).</p><p><strong>Model-based :</strong></p><p>This algorithm utilizes a user-item matrix with strengths calculated from claps, comments, and read time: expected time. Blogs can be recommended to a specific user based on the strengths of the blog.</p><p>The other one is a <strong>content-based recommendation engine</strong>. They are different in that they provide recommendations based on blog articles and the words included within them (mostly tags). If a person reads an article that includes the terms Machine learning and Data Science, it’s likely that the same user enjoys reading additional articles that include these terms.</p><p>Three other relevant articles are provided to the user as suggestions for continued reading in the medium for continuous reading for each article. The suggested articles were recently published by the same publication and contain any of the tags from the user’s current article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oLCZL54vcDJNjfe-" /><figcaption>Personalized Recommendation</figcaption></figure><p>Collaborative filtering examines users’ reading habits rather than the content of the articles themselves. So, if users who read blog entries about recommendation engines also read posts about other ML algorithms, even if the content of the other articles is substantially different, collaborative filtering will promote additional articles to these users.</p><p>Collaborative filtering has a drawback in that it requires a large amount of past user reading behaviour data to detect these patterns. Content-based recommendations can be made with little to no previous data, making them simpler to deploy. We can see that this is a hybrid technique that uses both collaborative and content-based filtering in the medium.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/0*X5XxM-5Oojs-Atug" /><figcaption>Medium utilizes a hybrid approach</figcaption></figure><h3>Evaluation Metrics:</h3><p>There are 2 primary ways of checking whether your recommendation system is performing as per expectations.</p><ol><li><strong>Online A/B Testing</strong></li><li><strong>Offline Evaluation Metrics</strong></li></ol><p><strong>Online metrics</strong> are the empirical results observed in your user’s interactions with real-time recommendations provided in a live environment. The most effective way to do this is by performing an A/B test. In a live environment, you have a <strong>Control</strong>: your existing system and the <strong>Version</strong> is your recommender system under test. This is because user behaviour is the ultimate test of our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*5vlem2hirY1jr_jXt8-QZA.png" /><figcaption>A/B Testing for the system helps understand user behaviour</figcaption></figure><p><strong>Then why use offline techniques for evaluation?</strong></p><p>Because they are the ONLY indicators you can look at while developing your recommendation systems. Always preferring to go with online metrics to collect user behaviour and scoring your system is expensive and time-consuming. Moreover, when continuous feedback are asked from users, they might become more hesitant to use our platform and not use it at all. Good accuracies in offline metrics followed by good online A/B scores are what you will be looking for.</p><p>Accuracies in the above methods depend on historical data and try to predict what actual <strong>users have already seen</strong>. If the data collected is too old, however high the accuracies may be, they won’t mean anything as your interests a year back will not be as same as your interests a year from now!</p><p>Some of the offline techniques for evaluation are as follows:</p><h4><strong>Root Mean Squared Error (RMSE):</strong></h4><p>RMSE is similar to MAE but the only difference is that the absolute value of the residual(see above image) is squared and the square root of the whole term is taken for comparison.</p><p>The advantage of using RMSE over MAE is that it penalizes the term more when the error is high. (Note that RMSE is always greater than MAE)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*TUKu5wnuk-eU2PHb.jpeg" /><figcaption>RMSE Score Formula</figcaption></figure><h4><strong>Hit Rate:</strong></h4><p>Hit Rate is a better alternative to MAE or RMSE. To measure a Hit Rate, we first generate top N recommendations for all the users in our <strong>test data set. </strong>If generated top N recommendations contain something that users rated — 1 hit! There are various versions of this one being the <strong>cumulative hit rate</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*1zo1PiEkJYeU4eTPAvFFPg.png" /></figure><h4><strong>MAP@K / MAR@K:</strong></h4><p>A recommender system typically produces an ordered list of recommendations for each user in the test set. MAP@K gives insight into how relevant the list of recommended items is, whereas MAR@K gives insight into how well the recommender is able to recall all the items the user has rated positively in the test set.</p><p>Other important metrics include <strong>Coverage</strong> which is the per cent of items in the training data the model is able to recommend on a test set. <strong>Personalization</strong> uses dissimilarity (1- cosine similarity) between user’s lists of recommendations. The higher the score, the higher is the dissimilarity meaning it is giving more personalization.</p><h3>Deployment</h3><p>If we can’t make a machine learning model work in production, then that model is of no use. It’s like a written blog that never got published. So, that’s why the deployment of the model is one of the most important steps to get benefit out of the developed model. Hence, we also need to deploy the recommender system after testing and tuning of the model is done.</p><p>There are few features that makes difference in the deployment of the recommender system, i.e. Scalability of the system, Latency of the system, Offline system or Online system, etc. Let’s have a look at a few of these features. The scalability of the model defines how the model will respond when the number of users and the amount of content increases. Scalability problems have significantly increased with the rapid growth of the e-commerce industry: modern recommendation engines are required to generate real-time results for large-scale applications. In other words, the performance of the recommendation model is measured in terms of throughput (number of inferences per second) and latency (time for each inference).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*b8_20XdYdR8cAGRKoZHsWQ.png" /><figcaption>Factors most important during production</figcaption></figure><h3>Conclusion</h3><p>We have discussed the complete methodology to design a Blog Recommendation System in this article. There can be other improvements and modifications that can be done in this design methodology. We have mentioned a few of the improvements that can be done on this system in the future plans section of this blog. In further blogs, we are planning to integrate deep learning, computer vision and other advanced techniques to improve the efficiency of the Blog Recommendation System.</p><h3>Future Scope</h3><ol><li>Explore various DL techniques in order to utilize the image and video data which are an integral part of the blogs.</li><li>Leverage blog content like keywords, references etc. in order to provide better recommendations.</li></ol><h3>References</h3><ol><li><a href="https://www.themarketingtechnologist.co/building-a-recommendation-engine-for-geek-setting-up-the-prerequisites-13/">https://www.themarketingtechnologist.co/building-a-recommendation-engine-for-geek-setting-up-the-prerequisites-13/</a></li><li><a href="https://www.themarketingtechnologist.co/a-recommendation-system-for-blogs-content-based-similarity-part-2/">https://www.themarketingtechnologist.co/a-recommendation-system-for-blogs-content-based-similarity-part-2/</a></li><li><a href="https://www.algolia.com/blog/ai/the-anatomy-of-high-performance-recommender-systems-part-1/">https://www.algolia.com/blog/ai/the-anatomy-of-high-performance-recommender-systems-part-1/</a></li><li><a href="https://medium.com/fnplus/evaluating-recommender-systems-with-python-code-ae0c370c90be">https://medium.com/fnplus/evaluating-recommender-systems-with-python-code-ae0c370c90be</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8748285300ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/almabetter/medium-blog-recommendation-8748285300ce">Medium Blog Recommendation</a> was originally published in <a href="https://medium.com/almabetter">AlmaBetter</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leveraging AI for Online Proctoring]]></title>
            <link>https://medium.com/almabetter/leveraging-ai-for-online-proctoring-1160924b56ee?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1160924b56ee</guid>
            <category><![CDATA[elearning]]></category>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[proctoring]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Sun, 13 Jun 2021 04:43:17 GMT</pubDate>
            <atom:updated>2021-06-13T07:34:26.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iDvqLTtr-jCfsSrX8hMrxA.png" /><figcaption>Working of a proctoring system</figcaption></figure><h3>Introduction</h3><p>While a variety of students— from grade school to Doctoral — are moving to web-based and remotely conducted tests, the role of <strong>proctoring services</strong> has become more important than ever. Proctoring companies like Mettl, ProctorU, Examus face a couple of primary difficulties. First is their ability to expand the test limit and the second is to keep the quality bar of proctoring high.</p><p>To tackle both these problems, a live stream camera isn’t sufficient. With a large number of students, no examiner can address character, cheating, and privacy concerns productively in a simultaneous manner. In the time of ML and AI, biometric arrangements appear to be the most appropriate go-to, and there are valid justifications for it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTR2EyrYNF2K9gk7GaHZhw.png" /><figcaption>Increase in the use of proctored devices in recent months</figcaption></figure><h3>Face Recognition</h3><p>Supported by ML-driven biometrics, face recognition can fill various needs — from enrolling understudies to the test and affirming their personality to getting their complete presence during the test.</p><p>By leveraging machine learning, face recognition can accomplish more than the approval of test members and ensure they are human. The innovation can help handle the issue of identity mischief, and using image processing techniques will actually help to recognize looks. Glasses, new haircuts and pictures rather than a human will not befuddle the framework. That cuts off some well-known deceiving techniques — like requesting that someone else step through the examination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*EKmI2DAF8MUhd2Y1" /><figcaption>Facial Recognition solutions to determine the authenticity of the person</figcaption></figure><h3>Student Identification</h3><p>Since distinguishing people utilizing their face raises privacy as well as protection concerns and may be viewed as inadmissible in certain societies, proctors are looking for alternate ways — like behavioural biometrics.</p><p>Less obtrusive than the older style ‘ID-to-the-camera’, social biometrics investigates remarkable human exercises like typing and keystroke designs, time spent on particular sections, excessive cursor movements etc. Computer-based intelligence empowered recognition thinks about a short-expression to a credible sample and affirms the understudy’s character at each phase of the assessment.</p><p>The interest in visual and social techniques will develop in light of the fact that they are exchangeable and can suit exceptional necessities: debilitated and disabled students may lean toward face recognition as opposed to typing. During crucial assessments like finals or accreditations, a few techniques can be joined to guarantee twofold security. At last, social biometrics are simpler to submit and feel less nosy than an ID filter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*naSVzPGZk59wNbbG.png" /><figcaption>Behavioural Biometrics are leveraged in Proctored Systems</figcaption></figure><h3><strong>Action monitoring</strong></h3><p>An AI-empowered proctor sees a test taker as a bunch of behaviour related situations — body position, eyes and head developments, discourse, and so forth The warnings are deviations from a ‘typical’ design: strange stance, hands under the work area, sneaky eyes. A few students think about such a methodology straight-up hostile — since it decreases an individual to a numeric score based on the underlying algorithm.</p><p>The biometrics factor makes computer vision more versatile by following responses and climate instead of developments — for instance, an adjustment of lighting.</p><p>Computer vision would already be able to examine a student for covered up gadgets like a camera focal point in a catch or radio waves from any sending gadget. Each unusual conduct episode implies a punishment point, with no compelling reason to rewatch the entire video — yet the last survey is up to the discretion of the examiner.</p><h3><strong>Wearable technology</strong></h3><p>Attempting to make managed assessments a less scary encounter, biometric delegating use wearable equipment. Smartwatches and wellness wristbands can follow developments, heartbeat and temperature to demonstrate anomalies, while machine learning-empowered examinations could monitor it continuously. Students are allowed to remain comfortable physically.<br>Wearable biometric-empowered innovation joined with activity following tackles one more issue. It saves time for both the examiner as well as the student involved, disposing of the need to direct visual reviews of understudy’s work areas and rooms through a webcam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uMU0GyCvMXuIN_Yo.jpg" /><figcaption>Wearable tech could be leveraged for proctoring</figcaption></figure><h3>Conclusions</h3><p>Biometric-empowered proctor systems can cover more students with less human exertion and presence included — and ensure all members feel good and convey the best outcomes.</p><p>Upgraded with AI and biometrics, the process of proctoring doesn’t meddle with an understudy’s insight and gets seamless. Specifically, it disposes of identity mischiefs, decreases the number of phoney tricking alarms, and makes distant and on-location administered tests not so much distressing but rather more available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1160924b56ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/almabetter/leveraging-ai-for-online-proctoring-1160924b56ee">Leveraging AI for Online Proctoring</a> was originally published in <a href="https://medium.com/almabetter">AlmaBetter</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Pre-Processing — How to Perform Data Cleaning?]]></title>
            <link>https://medium.com/almabetter/data-pre-processing-how-to-perform-data-cleaning-e97b1f095eec?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e97b1f095eec</guid>
            <category><![CDATA[preprocesing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Sun, 06 Jun 2021 15:46:05 GMT</pubDate>
            <atom:updated>2021-06-06T17:04:34.519Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Pre-Processing — How to Perform Data Cleaning?</h3><p>Data pre-processing is one of the most important steps in the process of <strong>Data Mining </strong>which deals with data processing as well as transforming the data into a more efficient form which helps in easier knowledge discovery. We understand that real-life data is often extremely fragmented and might be incomplete, inconsistent, and in some cases too large to process. This is where pre-processing comes in and in this blog, we would be discussing some of the <strong>data cleaning</strong> techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/0*_z9cIP70vDLCn-FW.png" /><figcaption>Various Types of Pre-Processing</figcaption></figure><h3>Why is Data Cleaning important?</h3><p>Data Cleaning implies the way toward distinguishing the erroneous, deficient, mistaken, immaterial or missing piece of the data and afterwards changing, supplanting or erasing them as per the need. Data cleaning is considered an essential component of fundamental data science.</p><p>Data is the most important thing for Analytics and Machine learning. In processing or Business data is required all over the place. With regards to genuine data, it isn’t impossible that data may contain fragmented, conflicting or missing qualities. Assuming the data is defiled, it might prevent the interaction or give erroneous outcomes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nDE4Gch8LbgC8EQO.jpg" /><figcaption>Various Data Cleaning Techniques</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/0*EqQSJqHK7jZ-cmYm.png" /><figcaption>Impact of data on Machine Learning Modeling.</figcaption></figure><h3>Inconsistent column :</h3><p>On the off chance that your DataFrame contains sections that are immaterial or you are never going to utilize them then you can drop them to give more spotlight on the columns, you will deal with. Let us look at an example.</p><pre>import numpy as np # linear algebraimport pandas as pd # data processing, CSV file I/O data={&#39;Name&#39;:[&#39;A&#39;,&#39;B&#39;,&#39;C&#39;,&#39;D&#39;,&#39;E&#39;,&#39;F&#39;,&#39;G&#39;,&#39;H&#39;]<br>      ,&#39;Height&#39;:[5.2,5.7,5.6,5.5,5.3,5.8,5.6,5.5],<br>      &#39;Roll&#39;:[55,99,15,80,1,12,47,104],<br>      &#39;Department&#39;:[&#39;CSE&#39;,&#39;EEE&#39;,&#39;BME&#39;,&#39;CSE&#39;,&#39;ME&#39;,&#39;ME&#39;,&#39;CE&#39;,&#39;CSE&#39;],<br>      &#39;Address&#39;:[&#39;polashi&#39;,&#39;banani&#39;,&#39;farmgate&#39;,&#39;mirpur&#39;,&#39;dhanmondi&#39;,&#39;ishwardi&#39;,&#39;khulna&#39;,&#39;uttara&#39;]}df=pd.DataFrame(data)<br>print(df)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/0*BcY-Zc9eSaLf-lrF.png" /><figcaption>Student data set</figcaption></figure><p>Here if we want to remove the “Height” column, we can use python <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html"><strong>pandas.DataFrame.drop</strong></a> to drop specified labels from rows or columns.</p><pre>DataFrame.<strong>drop</strong>(<em>self</em>, <em>labels=None</em>, <em>axis=0</em>, <em>index=None</em>, <em>columns=None</em>, <em>level=None</em>, <em>inplace=False</em>, <em>errors=&#39;raise&#39;</em>)</pre><p>Let us drop the height column. For this, you need to push the column name in the column keyword.</p><pre>df=df.drop(columns=&#39;Height&#39;)<br>print(df.head())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/0*beKmIUeJSEhngxDF.png" /><figcaption>“Height” column dropped</figcaption></figure><h3>Missing data:</h3><p>It is uncommon to have a real-world dataset without having any missing qualities. At the point when you begin to work with real-world data, you will track down that the majority of the dataset contains missing qualities. Dealing with missing qualities is vital since, supposing that you leave the missing qualities for what it’s worth, it might influence your investigation and machine, learning models. Thus, you should be certain that if your dataset contains missing qualities. In the event that you discover missing qualities in your dataset, you should deal with them. In the event that you track down any missing qualities in the dataset you can play out any of these three undertakings on it:<br>1. Leave as it is<br>2. Filling the missing values<br>3. Drop them<br>For filling the missing values we generally utilize various different techniques.</p><h3>Outliers:</h3><p>Assuming you are new to Data Science, the main inquiry that will emerge in your mind is “outliers’ meaning could be a little more obvious”. We should discuss the outliers first and afterwards, we will discuss the detection of these outliers in the dataset and what will we do in the wake of distinguishing the outliers.</p><p>According to Wikipedia,<br>“<em>In statistics, an </em><strong><em>outlier</em></strong><em> is a data point that differs significantly from other observations.</em>”</p><p>That implies an exception indicates an information point that is fundamentally unique in relation to the other information points in the informational collection. Exceptions can be made because of blunders in the examinations or the variability in the measurements. How about we take a gander at a guide to clear the idea.</p><p>So, now the question is how can we detect the outliers in the dataset.<br>For detecting the outliers we can use :<br>1. Box Plot<br>2. Scatter plot<br>3. Z-score</p><pre>dataset.plot(kind=&#39;scatter&#39; , x=&#39;initial_cost&#39; , y=&#39;total_est_fee&#39; , rot = 70)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/0*FSLlBGKR6p6L10Fl.png" /><figcaption>Scatter plotting with an outlier.</figcaption></figure><p>Here in Figure 9, there is an outlier with a red outline. After detecting this, we can remove this from the dataset.</p><pre>df_removed_outliers = dataset[dataset.total_est_fee&lt;17500]df_removed_outliers.plot(kind=&#39;scatter&#39;, x=&#39;initial_cost&#39; , y=&#39;total_est_fee&#39; , rot = 70)plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*ulbO_diHz2ax9inZ.png" /><figcaption>Scatter plotting with removed outliers.</figcaption></figure><h3>Duplicate rows:</h3><p>Datasets may consist of multiple duplicate entries across the rows. It is one of the easiest tasks to delete duplicate rows. To delete the duplicate rows you can use <strong>dataset_name.drop_duplicates()<em>.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/181/0*rNCVdhV4UlsPxLwB.png" /><figcaption>Data having duplicate rows</figcaption></figure><pre>dataset=dataset.drop_duplicates()#this will remove the duplicate rows.print(dataset)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/0*mJ-roldl7btPcDxt.png" /><figcaption>Data without duplicate rows</figcaption></figure><h3>Converting data types:</h3><p>In DataFrame data can be of many types. As example :<br>1. Categorical data<br>2. Object data<br>3. Numeric data<br>4. Boolean data</p><p>Some column’s information type can be changed because of some explanation or have a conflicting information type. You can change over starting with one information type then onto the next by utilizing <strong>pandas.DataFrame.astype</strong>.</p><h3>String manipulation:</h3><p>Quite possibly the most significant and fascinating pieces of information cleaning is string manipulation. In reality, the majority of the information is unstructured information. String manipulation implies the way toward evolving, parsing, coordinating, or investigating strings. For string manipulation, you ought to have some information about standard articulations. Here and there you need to extricate some worth from a huge sentence. Here string manipulation gives us a solid advantage.</p><p>Let say,<br><em>“This umbrella costs $12 and he took this money from his mother.”</em></p><p>If you want to exact the “$12” information from the sentence then you have to build a regular expression for matching that pattern. After that, you can use the python libraries. There are many built-in and external libraries in python for string manipulation.</p><h3>Conclusion:</h3><p>Data Cleaning is vital for making your examination and AI models mistake-free. A little blunder in the dataset can cause you a ton of issues. Every one of your endeavours can be squandered. Along these lines, consistently attempt to make your information clean. In the following piece of this blog, we will view the second pre-preparing strategy for example information transformation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e97b1f095eec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/almabetter/data-pre-processing-how-to-perform-data-cleaning-e97b1f095eec">Data Pre-Processing — How to Perform Data Cleaning?</a> was originally published in <a href="https://medium.com/almabetter">AlmaBetter</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Natural Language Processing]]></title>
            <link>https://medium.com/almabetter/basics-of-natural-language-processing-4a85cc8d56a0?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a85cc8d56a0</guid>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[nlp-basic]]></category>
            <category><![CDATA[nlp]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Tue, 04 May 2021 10:32:42 GMT</pubDate>
            <atom:updated>2021-05-04T12:19:19.446Z</atom:updated>
            <content:encoded><![CDATA[<p>Human beings are the most advanced species on Earth. Our success as humans comes from the ability to communicate and share information. That is precisely where the concept of developing a language comes into the picture and when we talk about the human language it is one of the most diverse and complex part of us considering a total of close to 6500 languages.</p><p>Another very well known fact is that in the 21st century, according to industry insights only 21% of available data is present in a structured form. Data is being generated as speech, audio, tweets, and messages i.e. majority of the data is present in the textual format thus being highly unstructured in nature. Now in order to produce significant and actionable insights from this data it is important to get acquainted with the techniques of text analysis and natural language processing aka NLP.</p><h3>Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHEPb7DgpdqA5bpTyHqBDg.png" /></figure><p><strong>Text Mining</strong> or <strong>Text Analysis </strong>is the process of deriving meaningful information from natural language text. It usually involves the process of structuring the input text, deriving patterns from the structured data and finally the interpreting and evaluating the output. On the other hand <strong>NLP </strong>refers to the artificial intelligence method of communicating with an intelligent system using the natural language. As text mining refers to process of deriving high quality information from the text the overall is to essentially turn the text into data analysis via the application of NLP. That is why text mining and NLP go hand in hand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aRGfPFz6TCEgbdtJ.png" /></figure><p>Natural language processing (NLP) is the intersection of computer science, linguistics and machine learning. The field focuses on communication between computers and humans in natural language and NLP is all about making computers understand and generate human language.</p><h3>Applications of NLP</h3><ol><li>One of the first and most important applications of NLP is <strong>sentiment analysis </strong>be it on twitter, facebook or any other social media forum.</li><li><strong>Chatbots</strong> is another very important application. This is common in many of the company websites which automate certain tasks and Q&amp;A through these bots.</li><li>Another application of NLP comes in the domain of <strong>speech recognition </strong>which also include the voice assistants like Siri, Cortana etc.</li><li><strong>Machine translation </strong>is another use case one of the most famous one being the google translator translating from one language to another and that too in real time.</li><li>Other applications include <strong>spell check, keyword searching and information extraction </strong>and <strong>advertisement matching</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SjZ6jH2Gy5rc4GOUM78I8A.png" /><figcaption>Various Applications of NLP</figcaption></figure><h3>Components of NLP</h3><p>NLP can be divided into 2 major components:</p><ol><li><strong>Natural Language Understanding</strong>: This is the process of mapping the given input in natural language into useful representation and analysing those aspects of language.</li><li><strong>Natural Language Generation: </strong>It is the process of generating meaningful phrases and sentences in the form of natural language from some internal representation.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*27hfTTlLKEOYyTsuiSpeEw.png" /></figure><p>The understanding part is much more difficult than the generation part as it takes a lot of time to understand a particular language, the intricacies of it. Going forward lets try and understand what are the steps involved in NLP.</p><h3>Various Steps for NLP</h3><ol><li><strong>Tokenisation</strong>: Its the first step of NLP. It is the process of breaking strings into tokens which in turn are small structures used for tokenisation. Eg “This is NLP” can be broken down into 3 tokens namely This , is , NLP.</li><li><strong>Stemming</strong>: It means normalising the words into its base or root form. Eg. Affects, affecting etc. comes from the base word “affect”. Stemming algorithm generally works by cutting the end or beginning of the word taking into account a list of common prefixes/suffixes that can be found in the infected word.</li><li><strong>Lemmitization</strong>: It takes into account the morphological analysis of the word. It is necessary to have a detailed dictionary which the algorithm can look through to link the form back to root word called ‘lemma’. Similar to stemming, it maps several words into one common root. But unlike stemming the output is a proper word which is not always the answer in stemming.</li><li><strong>POS Tags</strong>: Once we have the root forms of the token, next comes the POS tags . The grammatical type of the tokens is called the Parts of Speech or the POS tags. Eg. verb, noun, article, adjective etc. It indicates how a word functions in meaning as well as grammatically within the sentence.</li><li><strong>Named Entity Recognition</strong>: It is the process of detecting named entities i.e. person name , company names, locations etc. It has 3 steps primarily: Noun phase identification, the phrase classification and entity disambiguation. Following is the example of NER</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qziQ-7Crg94vra09XkJMWQ.png" /></figure><p>6. <strong>Chunking</strong>: This basically means picking up individual pieces of information and “grouping” them into bigger pieces. These are also called chunks. This helps in getting insights and meaningful information from the text.</p><p>All of these steps and functions are performed using the Natural Language Toolkit Language (nltk) python library and is used for various other text analysis and NLP tasks.</p><h3>Major Challenges in NLP</h3><p>There are still a number of Natural Language Processing limitations and problems:</p><ul><li>Contextual words and phrases and homonyms</li><li>Synonyms</li><li>Irony and sarcasm</li><li>Ambiguity</li><li>Errors in text or speech</li><li>Colloquialisms and slang</li><li>Domain-specific language</li><li>Low-resource languages</li><li>Lack of research and development</li></ul><p>Although the future looks extremely tough and challenging and full of threats for NLP, the discipline is developing at a very fast pace like never before and we are likely to reach a level of advancement in the coming years that will make complex applications look possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a85cc8d56a0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/almabetter/basics-of-natural-language-processing-4a85cc8d56a0">Basics of Natural Language Processing</a> was originally published in <a href="https://medium.com/almabetter">AlmaBetter</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intuition Behind K-Means Clustering]]></title>
            <link>https://medium.com/analytics-vidhya/intuition-behind-k-means-clustering-f1ef6006479?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1ef6006479</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[k-means]]></category>
            <category><![CDATA[k-means-clustering]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Thu, 29 Apr 2021 14:29:40 GMT</pubDate>
            <atom:updated>2021-04-30T15:53:23.517Z</atom:updated>
            <content:encoded><![CDATA[<p>Clustering in general is a technique used by many people in their lives. You might find countless examples of clustering around the world. It could be a group of people sharing a table at a restaurant or a food store that displays different sections of food items be it meat , vegetables etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*NufQC1_CzefnoByIi6mHfw.jpeg" /><figcaption>Example of Clustering</figcaption></figure><p>Similarly, in the world of machine learning clustering is a very common solution to a variety of unsupervised problems prevalent in the industry. It helps understand and make sense out of unstructured data such that <strong>clusters</strong> are formed having <strong>similar data points</strong> in the same cluster and having <strong>dissimilar data points</strong> in other clusters. A major use of clustering in the real life comes from the aspect of recommender systems such used by companies like Amazon to show you what you would like to buy based on your purchase history or OTT’s like Netflix which recommend you content based on your preferences and watch history.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TmvsQ4XaOxeb-TmKk1qgOw.png" /><figcaption>Popular Method of Clustering is K-Means</figcaption></figure><h3>What is K-Means Clustering?</h3><p>Let us first try and understand this using a day to day example. Suppose you recently shifted to a hostel and you are expected to do your laundry on your own. At the end of the month you realise that you don’t have any good clothes left and there’s no other way but to wash your clothes which by now have accumulated to become a big pile. Having never done it before, you immediately call your mother and ask for her advice. She explains that there are specifications for each variety of clothes. Some are washed in hot water, while some in cold water, some need air-drying in particular and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*6qo7htg99zajyzMR23UOqQ.jpeg" /><figcaption>A collection of clothes</figcaption></figure><p>In simple terms, K-Means is one of the simplest clustering algorithms whose primary goal is to group similar elements or data points into a cluster. Here k is an input which represents the number of clusters you want i.e. giving k=4 will fetch you exactly 4 clusters from the data.</p><p>To continue our analogy and to understand how it translates to clustering, let’s assume that your mother asks to divide the pile into 3 clusters (here, k=3). You pick 3 different clothes at random and those will be the starting process for the creation of clusters. Now go through the massive pile of clothes, and try and fit them in one of the 3 clusters based on the attributes like water temperature, drying temperature, colour. Do understand the best fit does not rely on the cluster; it merely depends on the starting point you take. Technically, this starting point is known as the <strong>centroid of the cluster</strong>. Also these items that you try to fit would not be identical in nature. Hence try and pick the best match you can for them from amongst the 3 options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*vS1Nzwo_zRRVvHhCvysTlA.jpeg" /><figcaption>Clusters of clothes each having a different set of attributes</figcaption></figure><p><strong><em>On what basis is this similarity understood?</em></strong></p><p>Simple. You just need to put each of the clothing items you pick from the pile closer/ far away from the starting item based on how similar they are i.e. the more similar the item more closer it will be to the starting point. At the end of this activity you realise that you have got 3 different clusters and you can start your washing activity. But wait………………………</p><p>This process is an iterative process. Since our starting points were kind of random, we need to make sure that ultimately our starting points need to be the best they can be. For this, we would need to determine the new centroid value for all the 3 clusters again and again till such a point that</p><ol><li>there are no shifts of clothing items between the clusters</li><li>you have done a considerable number of iterations to make the best clusters you could.</li></ol><p>Finally, if you are a perfectionist, you will have to repeat the above experiment for k=4,5,….. and so on until you get the best clusters possible.</p><h3>Algorithm behind K-Means</h3><ol><li>Cluster the data into k groups where the value of k is predefined.</li><li>At random, select total k points which may/may not be from the dataset which would be known as the cluster centres or centroids.</li><li>Assign the data points to their closest centroids based on any distance function. This step is called the <strong>Expectation </strong>step.</li><li>Calculate the centre point/ mean of each clusters again and replace it as the centroid point. This is the <strong>Maximisation</strong> step.</li><li>Repeat the <em>Expectation-Maximisation</em> steps until either no data points move from their previous clusters, or centroid does not change from the previous iteration.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoiAgxVbVR8Q-qvZLXqxCg.png" /><figcaption>Process of K-Means Clustering</figcaption></figure><p>Practical implementation of the above mentioned algorithm for a 2-D data on python is given below. Let’s have a look</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6kdn-exjaExFrjV1DgZNDA.png" /><figcaption>A raw dataset represented in the form of scatterplots</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fAl1BpUxRNF6EJGHb_hFw.png" /><figcaption>The dataset easily split into clusters using K-Means where k=4</figcaption></figure><p>Certain disadvantages observed while using this algorithm are as follows:</p><ul><li>It requires to specify the number of clusters (k) in advance.</li><li>It can not handle noisy data and outliers.</li><li>It is not suitable to identify clusters with non-convex shapes.</li></ul><h3>Conclusion</h3><p>K-means clustering is perhaps the most mainstream algorithm and generally the principal thing specialists apply when tackling grouping undertakings to find out about the construction of the dataset.</p><p>K-means clustering is perhaps the most mainstream algorithm and generally the principal thing specialists apply when tackling grouping undertakings to find out about the construction of the dataset. The objective of k-means is to group information into non-covering subgroups. It does an excellent job when the bunches have sort of spherical structures. To be a specialist, it’s nice to know the presumptions behind calculations/techniques of each algorithms so you would have a very smart intuition about the strength and shortcoming of every strategy. This will assist you with choosing when to utilise every strategy and under what conditions.</p><p>This blog gave you an overall understanding of the concept of K-Means and the intuition behind its algorithm.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1ef6006479" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/intuition-behind-k-means-clustering-f1ef6006479">Intuition Behind K-Means Clustering</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Linear Regression]]></title>
            <link>https://medium.com/analytics-vidhya/understanding-linear-regression-befd4d63c3d6?source=rss-37b2facdf8f6------2</link>
            <guid isPermaLink="false">https://medium.com/p/befd4d63c3d6</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[almabetter]]></category>
            <dc:creator><![CDATA[Rohan Roney]]></dc:creator>
            <pubDate>Wed, 07 Apr 2021 14:01:20 GMT</pubDate>
            <atom:updated>2021-04-12T15:50:08.754Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKSK9meu9Tsu-kHCul4M7Q.jpeg" /><figcaption>Linear Regression- One of the mainstays of Machine Learning</figcaption></figure><p>In the Machine Learning world, <strong>Linear Regression</strong> is a kind of <strong>parametric regression model </strong>that makes a forecast by taking the weighted normal of the independent features or variables of certain observations and adding a constant value to it called the intercept or bias term.</p><p>This implies that basically regression models will be models that have a specific fixed number of parameters/weights associated that rely upon the quantity of features, and they yield a numeric forecast, as for instance the cost of a house.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*a4m3GLmXXOrcNavjc9P6yQ.png" /><figcaption>Formula of Linear Regression</figcaption></figure><ul><li><strong><em>ŷ </em></strong>prediction value.</li><li><strong><em>n</em></strong> refers to the total number of variables/features of the dataset.</li><li><strong><em>xi</em></strong><em> </em>is the value of the<em> ith variable</em>.</li><li><strong><em>Θi</em></strong> are the parameters of the model, where <strong>Θ0</strong> is the bias term.</li></ul><p>This essentially is an equation of a line. The core idea is to obtain a line that best fits the data. The best fit line is the one for which the residual value also called the total prediction error (all data points) in the dataset are as small as possible ideally as close as 0. Error is the distance between the point of prediction vs actual value in the regression line.</p><h4>Understanding through an Example</h4><p>We need to consider the connection between the month to month e-commerce deals and the advertising costs. We have the review results for 7 online stores for the most recent year. The aim is to discover the condition of the straight line that fits the information best. The accompanying table addresses the study results from the 7 online stores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9pXJUGWZqnUCaIavGTFDOw.png" /></figure><p>We can see that there is a <strong>positive relationship</strong> between the monthly e-commerce sales (Y) and online advertising costs (X).</p><p><em>The positive correlation means that the values of the dependent variable (y) increase when the values of the independent variable (x) rise.</em></p><p>Thus, in the event that we need to anticipate the month to month e-commerce sales from the advertising costs, the higher the benefit of publicising costs, the higher our expectation of deals. In the event that you attempt to take a gander at the plot of the previously mentioned information we would notice the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*i4BW4rm6-vXZZQPGeFGIKw.png" /></figure><p>The Scatter plot shows the amount one variable influences another. In our model, above Scatter plot shows how much internet publicising costs influence the month to month online business deals. It shows their relationship. In the event that we attempt to fit a best fit line on it for example a regression line dependent on the algorithm, the chart turns out in the below mentioned way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*UhyKUQz0l_B--Ick0mvLdg.png" /></figure><p>The linear regression plans to track down the best-fitting straight line through the data points. The best-fitting line is known as the regression line. In the event that information focuses are nearer when plotted to making a straight line, it implies the connection between’s the two factors is higher. In our model, the relationship is solid. The connection can be positive as is in the given model, however can be negative too.</p><p>The blue inclining line in the above graph is the regression line and shows the anticipated score on internet business deals for every conceivable estimation of the advertising costs.</p><h4>Getting into the Math</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*guEUDGF1Wzsbyl8iNJgq5Q.png" /></figure><p>In the above equations,</p><p>y = the target variable.</p><p>x = the input variable.(x1,x2,…xp in case of multiple regression)</p><p>b0 = the intercept value also called bias term.</p><p>b1, b2,.. bp = Coefficients describing the linear relationship between a combination of the input variables and target variable.</p><p><strong>Effect of b0 on x-y relationship:</strong></p><p>The estimation of b0 characterizes the expectation of the mean of target (y) when input (x) is 0. In the event that we dole out b0 to be 0, we are coercively attempting to pass the line through the origin, where both x and y are 0 and 0. This might be useful sometimes, while decreasing accuracy value in others. Consequently, it’s essential to explore different avenues regarding the estimations of b0, according to the requirements of the dataset you’re working with.</p><p><strong>Effect of b1 on x-y relationship:</strong></p><p>In the event that b1 is more prominent than 0, the information variable emphatically affects the objective. The increment in one would prompt an expansion in the estimation of the other. Though, if b1 is under 0, the information and yield factors will have a contrarily corresponding or negative relationship. Hence, an increment in one would prompt a decline in the estimation of the other.</p><p>Expect we are given a dataset as plotted by the ‘x’ marks in the plot above. The point of the straight line i.e. the regression line is to discover a line like the blue line in the plot mentioned earlier that fits the given arrangement of preparing model best. This line in actuality is an effect of the parameters θ0 and θ1. So the target of the learning calculation is to track down the best parameters to fit the dataset. In other words, pick θ0 and θ1 so that hθ(x) is near y for the preparation models (x, y).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*oX5Cjm63y5wxp2JFa1QkIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*jk90SPV9B2tQbGFmWBuCJg.png" /><figcaption>Cost Function</figcaption></figure><p>Learning objective is then to minimise the value of the cost function i.e.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*oxqLmAsI2d7LKPUa1M_0HA.png" /></figure><p>This cost function is also called the <strong>squared error function</strong> because of obvious reasons. It is the most commonly used cost function for linear regression as it is simple and performs well.</p><h3>Some Major Metrics for Model Evaluations</h3><p>We realise that regression line attempts to fit a line that creates the least distinction among anticipated and real qualities, where these distinctions are impartial too. This distinction or error is otherwise called residual.</p><p><strong>Residual = actual value — predicted value</strong></p><p>It is imperative to take note of the fact that, prior to surveying or assessing our model with assessment metrics like R-squared, we should utilise residual plots.</p><p>Residual plots uncover a biased model, more than some other assessment metric. On the off chance that your residual plots look ordinary, feel free to, assess your model with different measurements.</p><p>Remaining plots show the residual quantities on the y-axis and anticipated qualities on the x-axis. On the off chance that your model is biased you can’t confide in the outcomes. Notwithstanding, on the off chance that there are any indications of a deliberate example, then your model can be called biased.</p><h3>Mean Squared Error (MSE)</h3><p>The most widely recognised measurement for regression tasks is MSE. It has a structure that is convex in nature. It is the mean of the squared difference of actual and predicted values. Since it is differentiable and has a curved shape, it is simpler for optimisations. MSE punishes large values of errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/0*mTgt5yPwP1n9k61z.png" /></figure><h3>Mean Absolute Error (MAE)</h3><p>This is just the mean of absolute quantity of difference between the target and predicted values anticipated by the model. Incase of outliers, this metric is not much preferred. MAE doesn’t punish huge values of errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/0*Tgz4N95wqkCAVcqN.png" /></figure><h3>R-squared or Coefficient of Determination</h3><p>This metric addresses the variance of the target variable clarified by the independent variables of the model. It estimates the strength of the connection between your model and the reliant variable.</p><p>To comprehend what R-square truly addresses let us consider the following situation where we measure the error of the model with and without the information on the independent variables.</p><p><strong><em>In the event that R² is high (say 1), the model addresses the variance of the reliant variable.</em></strong></p><p><strong><em>In the event that R² is low, the model doesn’t address the variance of the dependent variable and regression line is no better than taking the mean line as you are not utilising any data from these dependent variables.</em></strong></p><h3>Root Mean Squared Error (RMSE)</h3><p>This is the under root of mean of the squared difference of the actual value and the model predicted value</p><p>R-squared mistake is superior to RMSE. This is on the grounds that R-squared is relative while RMSE is an absolute measure of fit.</p><p>Fundamentally, RMSE is only the foundation of the normal of squared residuals. We realise that residuals are a proportion of how inaccessible the focuses are from the regression line. Hence, RMSE estimates the scatter of these residuals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/0*nT-QMm9V46Vru0ky.png" /></figure><h3>Adjusted R-squared</h3><p>The main difference between <strong>adjusted R-squared </strong>and R-square is that <strong>R-squared</strong> describes the amount of variance of the dependent variable represented by every single independent variable, while <strong>adjusted R-squared</strong> measures variation explained by only the independent variables that actually affect the dependent variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/0*-7V4fuQCWolFwJSb.png" /></figure><p><em>In the equation above, n is the number of data points while k is the number of variables in your model, excluding the constant.</em></p><p>R² will in general increment with an increment in the quantity of independent variables. However, this could be misdirecting. Accordingly, the changed R-squared punishes the model for adding more independent variables (k) that don’t fit the model.</p><h3>Assumptions taken for Linear Regression</h3><h3>1. The regression model is linear in the coefficients.</h3><p>This presumption tends to the practical type of the model. In stats, a regression model is linear when all terms in the model are either the intercept value or a parameter multiplied to the independent variable. You construct the model exclusively by adding the terms together. These standards oblige the model to one sort:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/0*Hp9-zvVigjuuzOeZ" /></figure><p>In the equation, the betas (βs) are the parameters that OLS estimates. Epsilon (ε) is the random error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mvKtsygYKBxRczhYmAsDZA.png" /></figure><h3>2. The error term has a population mean of zero</h3><p>The error represents the variation in the target variable that the independent factors don’t clarify. The error term should be accounted for by randomness. For your model to be unprejudiced, the mean estimation of the error should approach zero.</p><p>Assume the normal error is +7. This non-zero normal error shows that our model efficiently under-predicts the noticed qualities. Analysts allude to orderly blunder like this as a bias, and it implies that our model is deficient on the grounds that it isn’t right if we consider average.</p><h3>3. The error term has a constant variance (no heteroscedasticity)</h3><p>The variance in the erroneous quantities ought to be steady for all perceptions. As such, the fluctuation doesn’t change for every perception or for a scope of perceptions. This condition is known as homoscedasticity. In the event that the variance varies, we allude to that as heteroscedasticity.</p><p>The easiest way to check this assumption is to create a residuals versus fitted value plot. On this type of graph, heteroscedasticity appears as a cone shape where the spread of the residuals increases in one direction. In the graph below, the spread of the residuals increases as the fitted value increases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBMqE_ejRemNAOURt16E7Q.png" /><figcaption>Various Residual vs Fitted Values graph</figcaption></figure><h3>4. All independent variables are uncorrelated with the error term</h3><p>On the off chance that an independent variable is associated with the error, we can utilize it to foresee the error, which contradicts the thought that the error addresses unusual irregular mistakes. We need to figure out how to incorporate it in the regression model.</p><p>This supposition is additionally alluded to as exogeneity. At the point when this kind of connection exists, there is endogeneity. Infringement of this supposition can happen on the grounds that there is synchronisation between the target and dependent variables or estimation mistake in the autonomous factors.</p><p>What are some advantages and disadvantages of linear regression?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zl1axfF7-BuDvPNWJY1Fqw.png" /></figure><h3>In regression with multiple independent variables, the coefficient tells you how much the dependent variable is expected to increase when that independent variable increases by one, holding all the other independent variables constant.</h3><p>One major issue with the linear regression algorithm is the fact that its extremely prone to the problems of <strong>under-fitting and overfitting</strong>. To understand this we need to understand about <strong>Bias</strong> and <strong>Variance</strong> in detail.</p><p><strong>Bias — What exactly do you mean by Bias?</strong></p><p>Bias is the contrast between the mean forecast of our model and the right value which we are attempting to predict. Model with high bias gives almost no importance to training data and misrepresents the model by simplifying it extensively. It generally prompts high blunder on both the train and test sets.</p><p><strong>Variance — What exactly do you mean by Variance?</strong></p><p>Variance is the variation or spread of model prediction values across data points with respect to the mean value for a given information point which discloses to us spread of our information. Model with high variance tells us immense dependence on train set and doesn’t generalise the information which it hasn’t seen previously. Thus, such models perform very well on train information yet has high error rates on test information.</p><p>These 2 factors result in what we understand as fitting problems in the world of machine learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*hjm6c65x8rwPMJHjOt4Bnw.png" /><figcaption>Shows the different scenarios of variance and bias</figcaption></figure><ul><li>In supervised learning, under-fitting happens when a model unable to capture the underlying pattern of the data. These models usually have high bias and low variance. It happens when we have very less amount of data to build an accurate model or when we try to build a linear model with a nonlinear data. Also, these kind of models are very simple to capture the complex patterns in data like Linear and logistic regression.</li><li>In supervised learning, overfitting happens when our model captures the noise along with the underlying pattern in data. It happens when we train our model a lot over noisy dataset. These models have low bias and high variance. These models are very complex like Decision trees which are prone to overfitting.</li></ul><h3>Bias-Variance Tradeoff</h3><p>On the off chance that our model is excessively straightforward and has not very many parameters, it might have high bias and low variance. Then again on the off chance that our model has enormous number of parameters, it will have high variance and low bias. So we need to track down the right equilibrium without overfitting and under-fitting the information. This tradeoff in intricacy is the reason there is a tradeoff among bias and variance. An algorithm can’t be more perplexing and less unpredictable simultaneously.</p><p>Error Value = Variance + Bias² + Irreducible error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*DSATCgPRMFFVRUChFmc2eg.png" /><figcaption>The image captures Bias-Variance Tradeoff</figcaption></figure><p>An optimal balance of bias and variance would never overfit or under-fit the model.</p><h3>The significance of Regularisation process?</h3><p>If our model complexity exceeds this sweet spot, we are in effect overfitting our model; while if our complexity falls short of the sweet spot, we are under-fitting the model. With all of that in mind, the notion of regularisation is simply a useful technique to use when we think our model is too complex (models that have low bias, but high variance). It is a method for “constraining” or “regularising” the size of the coefficients (“shrinking” them towards zero). The specific regularisation techniques we’ll be discussing are Ridge Regression and Lasso Regression. Most famous Regularisation techniques used to address over-fitting and feature selection are:</p><p>1.<strong> L1 Regularisation</strong></p><p>2.<strong> L2 Regularisation</strong></p><p>A regression model that uses L1 regularisation technique is called <strong><em>Lasso Regression</em></strong> and model which uses L2 is called <strong><em>Ridge Regression</em></strong>.</p><p><strong><em>The key difference between these two is the penalty term.</em></strong></p><h3>Ridge Regression</h3><p><strong>Ridge regression</strong> adds “<em>squared magnitude</em>” of coefficient as penalty term to the loss function. Here, the <em>highlighted</em> part represents L2 regularisation element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*sX7jogTT_ggRVB9BCmEO1A.png" /><figcaption>Cost Function</figcaption></figure><p>Here, if <em>lambda</em> is zero then you can imagine we get back OLS. However, if <em>lambda</em> is very large then it will add too much weight and it will lead to under-fitting. Having said that it’s important how <em>lambda</em> is chosen. This technique works very well to avoid over-fitting issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUn3ouTm4BfzMY5pX0QU5Q.png" /><figcaption>Parameters reducing down towards 0</figcaption></figure><h3>Lasso Regression</h3><p><strong>Lasso Regression</strong> (Least Absolute Shrinkage and Selection Operator) adds “<em>absolute value of magnitude</em>” of coefficient as penalty term to the loss function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*AsiXulMbWrju1O5PfgWEUg.png" /><figcaption>Cost Function</figcaption></figure><p>Again, if <em>lambda</em> is zero then we will get back OLS whereas very large value will make coefficients zero hence it will under-fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8bOQlP071f3W9EJ7MyRdKQ.png" /><figcaption>Parameters reducing to 0 after certain values of alpha</figcaption></figure><h3>ElasticNet Regression</h3><p>Elastic Net first emerged as a result of critique on lasso, whose variable selection can be too dependent on data and thus unstable. The solution is to combine the penalties of ridge regression and lasso to get the best of both worlds. Elastic Net aims at minimising the following loss function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*XjDc54wcUkLcnSXmYjIH4Q.png" /><figcaption>Cost Function</figcaption></figure><p>where <em>α</em> is the mixing parameter between ridge (<em>α</em> = 0) and lasso (<em>α</em> = 1).</p><p>Now, there are two parameters to tune: <em>λ</em> and <em>α</em>. The <em>glmnet</em> package allows to tune <em>λ</em> via cross-validation for a fixed <em>α</em>, but it does not support <em>α</em>-tuning, so we will turn to <em>caret</em> for this job.</p><p>The <strong>key difference</strong> between these techniques is that Lasso shrinks the less important feature’s coefficient to zero thus, removing some feature altogether. So, this works well for <strong>feature selection</strong> in case we have a huge number of features. Traditional methods like cross-validation, stepwise regression to handle overfitting and perform feature selection work well with a small set of features but these techniques are a great alternative when we are dealing with a large set of features.</p><h3>Conclusion</h3><p>In this blog we understood in depth the concepts of linear regression through a very intuitive example. We dived deeper into the math behind it understood the bias terms the parameters associated to each features cost function minimisation etc. Further we went on to understand the various metrics used to evaluate our models. Understanding the various advantages and disadvantages we came across the concepts of variance and bias which are the major source of errors in any LR model and hence understood how to optimise our models through various regularisation techniques that are used in the industry.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=befd4d63c3d6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/understanding-linear-regression-befd4d63c3d6">Understanding Linear Regression</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>