<?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 AKASH RANJAN on Medium]]></title>
        <description><![CDATA[Stories by AKASH RANJAN on Medium]]></description>
        <link>https://medium.com/@powerakash8?source=rss-65c38493807d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*PvhM9h4yzzvsSq4TrBcHPQ.jpeg</url>
            <title>Stories by AKASH RANJAN on Medium</title>
            <link>https://medium.com/@powerakash8?source=rss-65c38493807d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 13:58:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@powerakash8/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[K-Means Clustering]]></title>
            <link>https://medium.com/backyard-programmers/k-means-clustering-6e672a3f77aa?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e672a3f77aa</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Fri, 20 May 2022 19:03:39 GMT</pubDate>
            <atom:updated>2022-05-20T19:03:39.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*TefNfrbptSWMWtqemxVXig.png" /></figure><h3>Introduction</h3><h4>What is Clustering?</h4><p><strong><em>Clustering</em></strong><em> is basically a type of </em><a href="https://en.wikipedia.org/wiki/Unsupervised_learning"><strong><em>Unsupervised learning method</em></strong></a><em>. It is the process of dividing the population into groups consisting of similar data points. Points lying in the same group are as similar as possible and points in different groups are as dissimilar as possible.</em></p><h4>Why Clustering?</h4><p><strong><em>Clustering</em></strong><em> </em><strong><em>helps in understanding the natural grouping in a dataset</em></strong><em>. Their purpose is to make sense to partition the data into some group of logical groupings. The main advantage of a clustered solution is </em><strong><em>automatic recovery from failure</em></strong><em>, that is, recovery without user intervention.</em></p><h4>Types Of Clustering:</h4><ol><li><strong><em>Exclusive Clustering</em></strong><em>: It is considered </em><strong><em>hard clustering</em></strong><em>. Here data points/items belong exclusively to one cluster. Example: </em><strong><em>K-Means Clustering.</em></strong></li><li><strong><em>Over Lapping Clustering</em></strong><em>: It is considered </em><strong><em>soft clustering</em></strong><em>. Here data points/items belong to multiple clusters. Example: </em><strong><em>Fuzzy/C-Means Clustering.</em></strong></li></ol><h3>K-Means Clustering</h3><h4>Introduction</h4><p><strong><em>K-Means Clustering</em></strong><em> is </em><strong><em>a type of unsupervised learning, which is used when you have unlabeled data (i.e., data without a Target Column)</em></strong><em>. The goal of this algorithm is to find groups in the data, with the number of groups represented by the variable K.</em></p><h4>Working</h4><p><em>Before applying any algorithm on datasets it’s necessary to understand it’s working so, let’s deep dive into the working of </em><strong><em>K-Means Clustering</em></strong><em>:</em></p><ol><li><em>At very first we need to choose the </em><strong><em>number K of Clusters</em></strong><em> (Let’s take K=2).</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*4H-B67JFsmRV1dSauMfR9g.png" /></figure><p>2. <em>Then selecting at</em><strong><em> random K points</em></strong><em>, the</em><strong><em> </em></strong><a href="https://en.wikipedia.org/wiki/Centroid"><strong><em>centroids</em></strong></a><strong><em> (not necessary from the dataset)</em></strong><em>.</em></p><p>3. <em>Then assign each data point to the </em><strong><em>closest centroid → that forms K Cluster</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*ME52drMDE3Km_abuLV_4lQ.png" /><figcaption><strong>Finding the Euclidean distance</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*HopXNXQvI-wWJgJZsR2tww.png" /><figcaption><strong>Separating both centroids by Red and Blue color.</strong></figcaption></figure><p>4. <em>Then it computes and </em><strong><em>places the new centroid of each cluster</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*H75ItnUQzUGZ0L05X1v0_w.png" /><figcaption><strong>Computing and shifting centroid</strong></figcaption></figure><p>5. <em>Reassigning each data point to the new closest centroid. If any reassignment took place, then we</em><strong><em> go to step 4, otherwise, our model is ready</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*XvzSwTBbfvTxGD1J1OC_1Q.png" /><figcaption><strong>Wrong data points</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*jtiXNZNkvlKSgm9w9yBLlg.png" /><figcaption><strong>Data Points correctly marked to the nearest centroids</strong></figcaption></figure><p><strong><em>Note:</em></strong><em> The Above Process continues until the best cluster is formed</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*7-zYvq56EdR8Kv5sKBUwUw.png" /><figcaption><strong>Final Model is Ready</strong></figcaption></figure><h4>How to Choose the Right Number of Clusters?</h4><p><em>Finding the right number of clusters is the most difficult and important part of the Algorithm. So, Let’s understand how to choose the right number of clusters in </em><strong><em>K-Means Clustering</em></strong><em>.</em></p><p><strong><em>WCSS</em></strong><em>: Also known as </em><strong><em>Within-Cluster-Sum of Squared. </em></strong><em>It is the</em><strong><em> sum of the squared distance between each point and the centroid in a cluster.</em></strong></p><p><em>I will try to show step by step what actually happens to the value of WCSS when the number of Clusters increases, Then I will show the best optimal method to find the right Cluster.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8d2duVQw7AEBwBgvolMkgQ.jpeg" /><figcaption><strong>WCSS(8000) is high when there is only one cluster</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g5_gbA1kt-ZfzjHIu12Iyw.jpeg" /><figcaption><strong>WCSS(3000) here decreases from the second one</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZ3F7vFPotmyTR0d0US3lw.jpeg" /><figcaption><strong>WCSS(1000) is the least here</strong></figcaption></figure><p><em>As we are able to find that </em><strong><em>WCSS is decreasing</em></strong><em> as we are trying to</em><strong><em> increase the clusters</em></strong><em>. Our main </em><strong><em>aim is to decrease the WCSS.</em></strong><em> The main task of knowing the right number of clusters is the point after which the </em><strong><em>WCSS decrease becomes almost constant.</em></strong><em> So instead of using plots, we will analyze it using the </em><strong><em>Elbow Method</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*TfMeJ5FGYnEdjBgen9bahA.png" /></figure><p><em>From the Above Elbow curve, we found that After 3 Clusters the value of WCSS becomes almost constant so the right number of clusters for this set of data points is 3.</em></p><h4>What would happen if we had a bad random initialization?</h4><p><em>Traditional k-means utilize a randomization process for initializing these centroids, poor initialization can lead to </em><strong><em>increased numbers of required clustering iterations to reach convergence, a greater overall runtime, and a less-efficient algorithm overall</em></strong><em>.</em></p><p><em>To solve this issue we have a solution that is the same as K-Means but has an advantage over bad random initialization called</em><strong><em> K-Means++</em></strong><em>. </em><strong><em>K-Means++</em></strong><em> is a </em><strong><em>smart centroid initialization technique</em></strong><em> and the rest of the algorithm is the same as that of </em><strong><em>K-Means</em></strong><em>. The steps to follow for centroid initialization are:</em></p><ul><li><em>Pick the first centroid point (C_1) randomly.</em></li><li><em>Compute the distance of all points in the dataset from the selected centroid. The distance of x_i point from the farthest centroid can be computed by</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/272/0*gco2ladwXr0033Dk.png" /></figure><pre>d_i: Distance of x_i point from the farthest centroid<br>m: number of centroids already picked</pre><ul><li><em>Make the point x_i as the new centroid that is having maximum probability proportional to d_i.</em></li><li><em>Repeat the above two steps till you find k-centroids.</em></li></ul><h4>Implementation:</h4><p><em>As of now, we have a rough idea of how </em><strong><em>K-Means Clustering</em></strong><em> works. So, Let’s implement it.</em></p><ol><li><em>Importing the Libraries:</em></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dxinImpEA83_BjzwpYTmGA.png" /></figure><p>2.<em> Importing, Reading DataSet, And Creating the Feature Matrix:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PVVybNICzCqNKBs5U7warg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*7XtgTXtFDtaJXv-X8kSG5Q.png" /></figure><p><strong><em>CustomerID </em></strong><em>is 100% Unique so will never contribute to Model Predictions.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UoSEMA4H5UdqF_QgeVnIWg.png" /></figure><blockquote>We are using just the last two features(<strong>Annual Income (k$)</strong>and <strong>Spending Score (1–100) </strong>) for clustering because I wanted to show you guys how clusters actually look if I will use all the features then it will become difficult for visualizing the clusters in a 2D plot.</blockquote><p>3. <em>Using the Elbow method to find the optimal number of clusters:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oVtGbBzdtc25RxHxDNnlMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*INL_lcZIc0ObJ_cMgE9MKQ.png" /><figcaption><strong>From the Elbow Method, we can say that 5 is the optimal number of Clusters</strong></figcaption></figure><p>4. <em>Training the </em><strong><em>K-Means model</em></strong><em> on the dataset:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SfxU7NKPrKDiKkr8k8KW-g.png" /></figure><p>5. Visualising the clusters:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gg26PB-1cIGfOFCyBOpPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*orEcYTDIpdeG5eM2Hy4dtA.png" /></figure><p><em>The source code of this is available on my </em><a href="https://github.com/akash-ranjan8/MACHINE_LEARNING_MODELS_IN_PYTHON/blob/master/K_Means_Clustering.ipynb"><strong><em>GitHub repository.</em></strong></a></p><h3>Summary:</h3><p><em>With this, we came to the end of our article on </em><strong><em>K-Means Clustering</em></strong><em>. I hope this article will help you in learning </em><strong><em>K-Means Clustering </em></strong><em>in a better manner.</em></p><p><em>For any queries contact me on </em><a href="https://www.linkedin.com/in/akash-ranjan-183018159"><strong><em>LinkedIn</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e672a3f77aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/k-means-clustering-6e672a3f77aa">K-Means Clustering</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Natural Language Processing(NLP)]]></title>
            <link>https://medium.com/backyard-programmers/natural-language-processing-nlp-b002bf363d3c?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b002bf363d3c</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Mon, 01 Nov 2021 19:12:49 GMT</pubDate>
            <atom:updated>2021-11-01T19:12:49.652Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dORuZEk0eyO3_THb6wAQAg.png" /></figure><h3><strong>Text Mining</strong></h3><p><em>It is the process of deriving meaningful information from Natural Language text. It refers to the process of deriving high quality information from the text. The overall goal of text is, essentially to turn text into data for analysis, via application of </em><strong><em>Natural Language Processing(NLP)</em></strong><em>.</em></p><h3><strong>Introduction to NLP</strong></h3><p><strong><em>Natural Language Processing (NLP)</em></strong><em> is a field of </em><strong><em>Artificial Intelligence</em></strong><em> that gives the machines the ability to read, understand and derive meaning from </em><strong><em>human languages</em></strong><em>. It is a part of </em><strong><em>Computer Science</em></strong><em> and </em><a href="https://en.wikipedia.org/wiki/Artificial_intelligence"><strong><em>AI</em></strong></a><strong><em> </em></strong><em>which deals with</em><strong><em> human language</em></strong><em>. It pursuit to fill the gap between </em><strong><em>human communication</em></strong><em> and </em><strong><em>computer understanding</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*XCXz4Zsx-L1YB-grPELG4w.png" /><figcaption>Representation of NLP through Venn Diagram</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*AT7kYg-JBi4wmuEBErMvsQ.png" /><figcaption>NLP as a Interface Layer</figcaption></figure><h3><strong>Why NLP is important??</strong></h3><ol><li><strong>Large Volume of textual data:</strong></li></ol><p><strong><em>Natural language processing</em></strong><em> helps </em><strong><em>computers communicate</em></strong><em> with </em><strong><em>humans in their own language and scales other language-related tasks.</em></strong><em> </em><strong><em>For example</em></strong><em>, </em><strong><em>NLP</em></strong><em> </em><strong><em>makes</em></strong><em> it </em><strong><em>possible for computers to read text, hear speech, interpret it</em></strong><em>, measure sentiment and determine which parts are important.</em></p><p>2. <strong>Structuring Unstructured data:</strong></p><p><strong><em>Human language</em></strong><em> is astoundingly complex and diverse. We </em><strong><em>express ourselves in infinite ways</em></strong><em>, both </em><strong><em>verbally</em></strong><em> and in</em><strong><em> writing</em></strong><em>. Not only are there hundreds of languages and dialects, but within each language is a </em><strong><em>unique set of grammar</em></strong><em> and </em><strong><em>syntax rules, terms and slang</em></strong><em>. When we write, we often misspell or abbreviate words, or omit punctuation. When we speak, we have regional accents, and we mumble, stutter and borrow terms from other languages. </em><strong><em>NLP helps to structure the data.</em></strong></p><h3>Branches of NLP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*Uw0qXvLzKZ-noEpnZ6Qi1Q.png" /><figcaption>Branch of NLP</figcaption></figure><ol><li><strong>Natural Language Understanding(NLU): <em>NLU</em></strong><em> is </em><strong><em>branch of</em></strong><em> </em><strong><em>natural language processing (NLP)</em></strong><em>, which </em><strong><em>helps computers understand and interpret human language by breaking down the elemental pieces of speech</em></strong><em>. In </em><strong><em>NLU,</em></strong><em> </em><strong><em>machine learning models improve over time as they learn to recognize syntax, context, language patterns, unique definitions, sentiment, and intent.</em></strong><em> NLU </em><strong><em>enables human-computer interaction</em></strong><em>.</em></li><li><strong>Natural Language Generation(NLG): <em>Natural language generation</em></strong><em> (NLG) is the </em><strong><em>use </em></strong><em>of artificial intelligence </em><strong><em>(AI) programming to produce written or spoken narratives from a data set.</em></strong><em> This </em><strong><em>enables the chatbot</em></strong><em> to </em><strong><em>interrogate data repositories, including integrated back-end systems and third-party databases, and to use that information in creating a response.</em></strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*f0dFUtdH_YAP1kvBDSZUeg.png" /><figcaption>NLG Working</figcaption></figure><h3><strong>Applications of NLP</strong></h3><p><strong>Search Autocorrect and Auto Complete:</strong></p><p><em>Whenever we </em><strong><em>search for something on Google</em></strong><em>, after </em><strong><em>typing 2–3 letters</em></strong><em>, it s</em><strong><em>hows you the possible search terms</em></strong><em>. Or, if we search for something with typos, </em><strong><em>it corrects them and still finds relevant results for you.</em></strong><em> It’s a wonderful </em><strong><em>application of natural language processing</em></strong><em> and a great example of how it is affecting millions around the world.</em></p><p><strong>Language Translator:</strong></p><p><em>Have you ever used </em><strong><em>Google Translate</em></strong><em> to find out what a particular word or phrase is in a different language? I’m sure it’s a YES!! The technique behind it is </em><strong><em>Machine Translation</em></strong><em>. It is the procedure of </em><strong><em>automatically converting the text in one language to another language while keeping the meaning intact. </em></strong><em>These tools are helping numerous people and businesses in breaking the language barrier and becoming successful.</em></p><p><strong>Chatbots:</strong></p><p><em>Customer service and experience are the most important thing for any company. It can help the companies improve their products, and also keep the customers satisfied. But interacting with every customer manually, and resolving the problems can be a tedious task. This is where </em><strong><em>Chatbots</em></strong><em> come into the picture. </em><strong><em>Chatbots help</em></strong><em> the</em><strong><em> companies</em></strong><em> in </em><strong><em>achieving</em></strong><em> the </em><strong><em>goal of smooth customer experience</em></strong><em>. Today, many companies use chatbots for their apps and websites, which solves basic queries of a customer. </em><strong><em>It </em></strong><em>not only makes the process easier for the companies but also </em><strong><em>saves customers from the frustration of waiting to interact with customer call assistance.</em></strong><em> Additionally, it can reduce the cost of hiring call center representatives for the company.</em></p><p><strong>Voice Assistants:</strong></p><p><em>I am sure you’ve already met them, </em><strong><em>Google Assistant, Apple Siri, Amazon Alexa</em></strong><em>? Yes, well all of these are </em><strong><em>voice assistants</em></strong><em>. A </em><strong><em>voice assistant is a software that uses speech recognition, natural language understanding, and natural language processing to understand the verbal commands of a user and perform actions accordingly</em></strong><em>. They are </em><strong><em>much more than a chatbot </em></strong><em>and can do many more things than a chatbot can do.</em></p><p><strong>Ambiguities with NLP:</strong></p><ol><li><strong>Lexical Ambiguity: </strong><em>This type of ambiguity</em><strong><em> represents words that can have multiple assertions</em></strong><em>. It is</em><strong><em> caused when two words have the same form or when a word has more than one meaning</em></strong><em>. </em><strong><em>For example:</em></strong><em> She is looking for a match, here match may be a cricket match , life partner, etc.</em></li><li><strong>Syntactic Ambiguity: </strong><em>This type of ambiguity </em><strong><em>represents sentences that can be parsed in multiple syntactical forms</em></strong><em>. It </em><strong><em>occurs whenever a sentence can be understood as having two or more distinct meanings as a result of the order of the words within the sentence. For example:</em></strong><em> The chicken is ready to eat, means that it is ready to eat or ready to eat for dinner.</em></li><li><strong>Semantic Ambiguity: </strong><em>This type of ambiguity is typically </em><strong><em>related to the interpretation of sentence</em></strong><em>. It exists </em><strong><em>when a word form corresponds to more than one meaning. For Example: </em></strong><em>as in the English word “organ”, which denotes both a body part and a musical instrument.</em></li></ol><h3>Six Major Components of NLP:</h3><h4>Tokenization:</h4><p><em>The </em><strong><em>initial step in NLP is tokenization</em></strong><em> which </em><strong><em>basically means breaking string into words.</em></strong><em> It is the </em><strong><em>process by which we break a complex sentence into words.</em></strong></p><p><strong>Types:</strong></p><ol><li><strong>Bigrams:</strong> <em>Tokens of two consecutive written words.</em></li><li><strong>Trigrams:</strong> <em>Tokens of three consecutive written words.</em></li><li><strong>N-grams:</strong> <em>Tokens of any number of consecutive written words.</em></li></ol><h4>Stemming:</h4><p><em>Stemming is the </em><strong><em>process of reducing a word to its word stem that affixes to suffixes and prefixes or to the roots of words known as a lemma</em></strong><em>. For Example Converting Amusement, Amusing, Amused to Amuse.</em></p><h4>Lemmatization:</h4><p><em>Lemmatization usually refers to </em><strong><em>doing things properly with the use of a vocabulary and morphological analysis of words</em></strong><em>, normally aiming to remove inflectional endings only and to return the base or dictionary form of a word, which is known as the </em><strong><em>lemma</em></strong><em> . This is</em><strong><em> similar to Stemming</em></strong><em> but the </em><strong><em>only difference between them is that the root word of Lemmatization is always a proper word.</em></strong></p><h4>Parts Of Speech(POS) Tags:</h4><p><em>It is </em><strong><em>a process of converting a sentence to forms — list of words, list of tuples</em></strong><em> (where each tuple is having a form (word, tag)). The </em><strong><em>tag in case of is a part-of-speech tag, and signifies whether the word is a noun, adjective, verb, and so on.</em></strong></p><h4>Named Entity Recognition:</h4><p><strong><em>Named entity recognition is a natural language processing technique</em></strong><em> that can </em><strong><em>automatically scan entire articles </em></strong><em>and </em><strong><em>pull out some fundamental entities in a text and classify them into predefined categories.</em></strong><em> Entities may be,</em></p><ul><li><em>Organizations,</em></li><li><em>Quantities,</em></li><li><em>Monetary values,</em></li><li><em>Percentages, and more.</em></li><li><em>People’s names</em></li><li><em>Company names</em></li><li><em>Geographic locations (Both physical and political)</em></li><li><em>Product names</em></li><li><em>Dates and times</em></li><li><em>Amounts of money</em></li><li><em>Names of events</em></li></ul><h4>Chunking:</h4><p><em>Chunking in NLP is </em><strong><em>a process to take small pieces of information and group them into large units</em></strong><em>. The primary use of Chunking is making groups of “noun phrases.” It is used to add structure to the sentence by following POS tagging combined with regular expressions.</em></p><h3>Implementing NLP to Dataset:</h3><p><em>So, now we have understood concepts of NLP . let’s deep dive and understand step by step procedure to implement it in real world.</em></p><h4><strong>Fake News Classifier</strong></h4><h4>Importing the Libraries:</h4><p><em>The very first step of the implementation is to download all the required NLTK libraries.</em></p><p><strong>NLTK:</strong> <strong><em>NLTK stands for Natural Language Tool Kit</em></strong><em>. It contains text processing libraries for tokenization, parsing, classification, stemming, tagging and semantic reasoning. It also includes graphical demonstrations and sample data sets as well as accompanied by a cook book and a book which explains the principles behind the underlying language processing tasks that NLTK supports.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1dYPI9l8ucoDLejt00X6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkW5gXlU3FGR2GWs2q4r0Q.png" /></figure><h4>Preprocessing Text</h4><p><em>Now we will preprocess text. In this step we will first remove all the stop words, then we will apply either stemming or lemmatization as per business use case.</em></p><p><strong>Stop Words:</strong></p><p><em>Stop words are a set of commonly used words in a language. Examples of stop words in English are “a”, “the”, “is”, “are” and etc. Stop words are commonly used in Text Mining and Natural Language Processing (NLP) to eliminate words that are so commonly used that </em><strong><em>they carry very little useful information</em></strong><em>.</em></p><p><em>For this use case I had used Stemming for preprocessing the news text.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ntRyRNrfTI9epGaVEuau5g.png" /></figure><h4>Feature Extraction for the text</h4><p><em>This step is carried out using three methods depending on the use cases:</em></p><ol><li><strong>Bag of Words: </strong><em>A bag-of-words is </em><strong><em>a representation of text that describes the occurrence of words within a document</em></strong><em>. It involves two things:</em></li></ol><p><em>a) A vocabulary of known words.</em></p><p><em>b) Measure of the presence of known words.</em></p><p>2. <strong>TF-IDF: </strong><em>TF-IDF (</em><strong><em>term frequency-inverse document frequency</em></strong><em>) is a statistical measure that evaluates how relevant a word is to a document in a collection of documents.</em></p><ul><li><strong><em>Term Frequency</em></strong><em>: is a scoring of the frequency of the word in the current document.</em></li><li><strong><em>Inverse Document Frequency</em></strong><em>: is a scoring of how rare the word is across documents.</em></li></ul><blockquote><strong><em>IDF =Log[(# Number of documents) / (Number of documents containing the word)]</em></strong></blockquote><blockquote><strong><em>TF = (Number of repetitions of word in a document) / (# of words in a document)</em></strong></blockquote><blockquote><strong>TF-IDF = TF * IDF</strong></blockquote><p>3.<strong> Word2Vec :</strong></p><p><em>In </em><strong><em>Both Bag Of Words</em></strong><em> and </em><strong><em>TF-IDF </em></strong><em>approach </em><strong><em>word semantic is not stored</em></strong><em>. And there is also </em><strong><em>chances of Overfitting</em></strong><em>.</em></p><p><em>In </em><strong><em>Word2Vec</em></strong><em> , each </em><strong><em>word is basically represented as a vector of 32 or more dimension instead of a single number.</em></strong><em> And here the </em><strong><em>semantic information</em></strong><em> and </em><strong><em>relation between different words is also preserved.</em></strong></p><p><em>For this </em><strong><em>use case</em></strong><em> I had </em><strong><em>used Bag of Words for extracting features</em></strong><em> you can use any one of the above.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fgEF0MdtDS4W6XfXkrYbjw.png" /></figure><h4>Modelling</h4><p><em>Now we will apply various </em><strong><em>Machine learning model</em></strong><em> and will </em><strong><em>predict the output and accuracy of our model</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yjIGaJAqLLK4YpsNn_9y4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*nWLjKnwiU44v9uVbKDdWFQ.png" /><figcaption>Confusion Matrix</figcaption></figure><p><em>The Source code of this is available on my </em><a href="https://github.com/akash-ranjan8/NLP/blob/main/Fake_News_Classifier.ipynb"><strong><em>github repository</em></strong></a><em>.</em></p><h3>Summary</h3><p><em>With this we came to the end of our article on Natural Language Processing. I hope this article will help you in learning </em><strong><em>Natural Language Processing(NLP)</em></strong><em> in a better manner.</em></p><p><em>For any queries contact me over </em><a href="https://www.linkedin.com/in/akash-ranjan-183018159"><strong><em>linkedin</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b002bf363d3c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/natural-language-processing-nlp-b002bf363d3c">Natural Language Processing(NLP)</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick Guide to Artificial Intelligence]]></title>
            <link>https://medium.com/backyard-programmers/quick-guide-to-artificial-intelligence-49671072f937?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/49671072f937</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Mon, 10 May 2021 13:43:34 GMT</pubDate>
            <atom:updated>2021-05-10T13:43:34.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RAnc7saX-sLIKrGnnh9BQ.png" /></figure><h4>What is Artificial Intelligence??</h4><p>- When most people hear the term Artificial Intelligence the first thing that comes to their mind is the fascinating robots. That’s because of the big budget films and novels weave stories about human-like machines that wreak havoc on earth.</p><p>- Artificial Intelligence commonly known as AI refers to the simulation of human intelligence in machines that are programmed to think like humans and also mimic their actions. This can also be termed as machines exhibiting traits associated with the human mind such as problem solving and learning.</p><p>- The Ideal characteristic of Artificial Intelligence is its ability to rationalize and take actions which are best for achieving goals.</p><ul><li>The goals of Artificial Intelligence includes learning, reasoning and perception.</li></ul><h4><strong>Subfields Of Artificial Intelligence:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*byKjlcJJT_F6SjCaQ7yBxA.png" /></figure><p>- Artificial Intelligence can be considered superset of Machine Learning and Machine Learning can be considered superset of Deep Learning.</p><p>- <strong>Machine Learning: </strong>It is a subset of Artificial Intelligence based on the idea that systems can learn from data, identify patterns and make decisions with minimal human intervention. It builds models based on sample data basically called as training data. It is widely used in applications like email filtering ,Online Fraud Detection.</p><ul><li><strong>Deep Learning: </strong>It is a subset of Machine Learning in Artificial Intelligence that uses deep neural networks which are capable of learning unsupervised from data that is unstructured or unlabeled. It is widely used in the field of Natural Language Processing, Speech recognition, audio recognition, etc.</li></ul><h4><strong>What are the Prerequisites of Artificial Intelligence??</strong></h4><p>- Before diving into any field it’s necessary to know the prerequisites of that field. So let’s learn prerequisites of Artificial Intelligence:</p><p>- Strong knowledge of Mathematics.</p><p>- Good command over programming languages.</p><p>- Good Analytical skills.</p><p>- Ability to understand complex algorithms.</p><p>- Basic knowledge of statistics and modelling.</p><p>- Good command on Python or R language.</p><p>- Basics ideas regarding data extraction, data manipulation and data visualization.</p><p>- Basic ideas regarding supervised and non-supervised learning.</p><p>- Basic ideas on Machine Learning Algorithms.</p><p>- Basic ideas regarding Neural Networks.</p><p>- Basic ideas on Deep Learning Algorithms.</p><ul><li>Must have the ability to write algorithms to find patterns and learning.</li></ul><h4><strong>Online Courses and Certification for Artificial Intelligence:</strong></h4><p>- <a href="https://www.coursera.org/learn/introduction-to-ai"><strong>Introduction to Artificial Intelligence (Offered by IBM)</strong></a><strong>:</strong>This online course is for everyone and no prior background in Artificial intelligence required. You will gain basics of Machine Learning, Deep Learning, Data Science And various job opportunities.You will also demonstrate AI in action with a mini project.You’ll also receive a certificate from IBM after completion of course.</p><p>- <a href="https://www.coursera.org/professional-certificates/applied-artifical-intelligence-ibm-watson-ai"><strong>IBM Applied AI Professional Certificate</strong></a><strong>:</strong>This online course will give you a firm understanding of AI technology, its applications, and its use cases. You will become familiar with concepts and tools like machine learning, data science, natural language processing, image classification, image processing, IBM Watson AI services, OpenCV, and APIs.In addition to earning a Professional Certificate from Coursera, you’ll also receive a digital badge from IBM recognizing your proficiency in applied AI after completion of course.</p><p>- <a href="https://www.coursera.org/specializations/ai-foundations-for-everyone"><strong>AI Foundations for Everyone Specialization</strong></a><strong>:</strong>This specialization course is designed for those with little or no background in AI. It is designed to give you a firm understanding of what is AI, its applications and use cases across various industries. You will become acquainted with terms like Machine Learning, Deep Learning and Neural Networks. it will familiarize you with IBM Watson AI services that enable any business to quickly and easily employ pre-built AI smarts to their products and solutions.You all will receive a certificate from IBM after the completion of course.</p><p>- <a href="https://www.coursera.org/specializations/key-technologies-for-business"><strong>Key Technologies for Business Specialization</strong></a><strong>:</strong> This online course is offered by IBM.The courses in this Specialization provide foundational knowledge of Cloud, Data and AI, including business drivers behind their growth, the value they provide, their applications and use cases, and an understanding of how these technologies work. This specialization is suitable for all including beginners, Managers and executives. You will get a certificate after completion of course.</p><p>- <a href="https://www.coursera.org/specializations/ibm-ai-foundations-for-business"><strong>IBM AI Foundations for Business Specialization</strong></a>:This specialization course will explain and describe the overall focus areas for business leaders considering AI-based solutions for solving business problems. The first course provides a business-oriented summary of technologies and basic concepts in AI. The second course will introduce the technologies and concepts in data science. The third course will introduce the AI Ladder, which is a framework for understanding the work and processes that are necessary for the successful deployment of AI-based solutions. You will gain a professional certificate from IBM after completion of course.</p><h4><strong>Online Courses and certification in Machine Learning:</strong></h4><ul><li><a href="https://www.coursera.org/learn/machine-learning"><strong>Machine Learning (Offered by StandFord University)</strong></a><strong>:</strong> This is one of the best courses available online for learning Machine Learning. The course is taught by <strong>Andrew Ng</strong> who is co-founder of Coursera one of the top instructors in the world for Data Science. This course will provide a broad introduction to machine learning, datamining, and statistical pattern recognition. You will be gaining a professional certificate after completion of course.</li><li><a href="https://www.udemy.com/course/machinelearning/"><strong>Machine Learning A-Z in (Python or R</strong></a>): This course is offered by Udemy. This course has been designed by two professional Data Scientists <a href="https://www.udemy.com/user/kirilleremenko/"><strong>Kirill Eremenko</strong></a> and <a href="https://www.udemy.com/user/hadelin-de-ponteves/"><strong>Hadelin de Ponteves</strong></a>. You all will gain constant support throughout the course from the <strong>SuperDataScience</strong> team. You will gain a certificate from Udemy after completion of this course.</li></ul><h4><strong>Career opportunities in Artificial Intelligence:</strong></h4><ul><li><strong>Machine Learning Engineer:</strong> A Machine Learning Engineer creates programs and algorithms that enable machines to take actions without being directed. One of the best examples is designing a self driving car.</li><li><strong>Data Scientist:</strong> Data Scientists are responsible for solving vexing problems. Combining computer science, modelling, statistics, analytics and math skills along with sound business data scientist helps organizations to make objective decisions.</li><li><strong>Machine Learning Architect:</strong> Machine Learning Architects are chief data scientists responsible for choosing the right technologies and evaluating the evolution of the architecture as the client needs change.</li><li><strong>AI Engineer: </strong>An AI engineer builds AI models using machine learning algorithms and deep learning neural networks to draw business insights, which can be used to make business decisions that affect the entire organization development.</li><li><strong>Data Analyst</strong>: A Data Analyst collects, organises and interprets statistical information to make it useful for a range of businesses and organisations.</li></ul><h4><strong>Summary:</strong></h4><ul><li>With this we came to the end of our article on Artificial Intelligence. I hope you all have an idea on how to start your career in the field of Artificial intelligence.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49671072f937" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/quick-guide-to-artificial-intelligence-49671072f937">Quick Guide to Artificial Intelligence</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Support Vector Machine(SVM) in Machine Learning]]></title>
            <link>https://medium.com/backyard-programmers/support-vector-machine-svm-in-machine-learning-4d2a4fcdcdd1?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d2a4fcdcdd1</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Thu, 21 Jan 2021 21:38:05 GMT</pubDate>
            <atom:updated>2021-01-21T21:38:05.296Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Support Vector Machine?</h3><p>“<strong>Support Vector Machine</strong>” (SVM) is a supervised <strong>machine learning algorithm</strong> which can be used for both classification or regression problems. However, it is mostly used in classification problems. In the SVM algorithm, we plot each data item as a point in n-dimensional space (where n is number of features you have) with the value of each feature being the value of a particular coordinate. Then, we perform classification by finding the <strong>hyper-plane</strong> that differentiates the two classes very well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*cM53H5MGUsMm7_eVVeQFag.png" /><figcaption>Plot of Support Vector Machine(SVM)</figcaption></figure><p><strong>Support Vectors:</strong></p><p>Support vectors are the data points, which are closest to the hyperplane. These points will define the separating line better by calculating <strong>margins</strong>. These points are more relevant to the construction of the classifier.</p><p><strong>Hyperplane:</strong></p><p>A <strong>hyperplane</strong> is a decision plane which separates between a set of objects having different class memberships.</p><p><strong>Margin:</strong></p><p>A <strong>margin</strong> is a gap between the two lines on the closest class points. This is calculated as the perpendicular distance from the line to support vectors or closest points. If the margin is larger in between the classes, then it is considered a good margin, a smaller margin is a bad margin.</p><h3>How does SVM work?</h3><p>The main objective is to <strong>segregate</strong> the given dataset in the best possible way. The distance between the either nearest points is known as the margin. The objective is to select a hyperplane with the maximum possible margin between support vectors in the given dataset. SVM searches for the maximum <strong>marginal hyperplane</strong> in the following steps:</p><ol><li>Generate hyperplanes which segregates the classes in the best way. <strong>Left-hand side figure</strong> showing<strong> three hyperplanes black, blue and orange</strong>. Here, the blue and orange have higher classification error, but the black is separating the two classes correctly.</li><li>Select the <strong>right hyperplane</strong> with the <strong>maximum segregation</strong> from the either nearest data points as shown in the <strong>right-hand side figure</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*sgeianW7cxk6A3aBCs734Q.png" /></figure><h4>Dealing with non-linear and inseparable planes:</h4><p>Some problems can’t be solved using <strong>linear hyperplane</strong>, as shown in the figure below <strong>(left-hand side)</strong>.</p><p>In such situation, <strong>SVM</strong> uses a <a href="https://data-flair.training/blogs/svm-kernel-functions/#:~:text=SVM%20Kernel%20Functions,it%20into%20the%20required%20form.&amp;text=For%20example%20linear%2C%20nonlinear%2C%20polynomial,(RBF)%2C%20and%20sigmoid."><strong>kernel </strong></a>trick to transform the input space to a higher dimensional space as shown on the right. The data points are plotted on the x-axis and z-axis (Z is the squared sum of both x and y: z=x²=y²). Now we can easily segregate these points using linear separation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*sBsLirYfMM4tRBPXdUXgng.png" /></figure><p>Let’s Code:</p><ol><li>Import the Libraries and dataset:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qVyF3EfNkdO9YRtLbqaOvw.png" /></figure><p>2. Splitting the dataset into train and test set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*09l1OwOAFf5ypKtxwY93GA.png" /></figure><p>3. Applying Feature Scaling on train set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwGQgUNXjG67BZ6o_6Nl3A.png" /></figure><p>4. Training the SVM model on the Training set:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_St6Chvn3pebS0TSKrcMVg.png" /></figure><p>5. Predicting the test set results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k_Ui-eCu2n8dm97qgX3Viw.png" /></figure><p>6. Making the Confusion Matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6JCps32ZrIb6JdgianQzuw.png" /></figure><p>7. Visualizing the train set result using Matplotlib:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DOXeUy2qFuRwjPPkw6jZGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*G2VSPS67K9JilxrpdR_GeQ.png" /></figure><p>8. Visualizing the Test set Results Using Matplotlib:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_errObmnw7jgVIkEAeb-JQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*sBCMWVIn6rV2so5BGWsMlQ.png" /></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/MACHINE_LEARNING_MODELS_IN_PYTHON/blob/master/support_vector_machine.ipynb"><strong>github repository</strong></a>.</p><p><strong>Closing Note: </strong>I hope this blog will help you in learning <strong>Support Vector Machine</strong> <strong>(SVM)</strong> in a better way.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d2a4fcdcdd1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/support-vector-machine-svm-in-machine-learning-4d2a4fcdcdd1">Support Vector Machine(SVM) in Machine Learning</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Genetic Algorithm]]></title>
            <link>https://medium.com/backyard-programmers/genetic-algorithm-b5bea51dd969?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5bea51dd969</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Fri, 23 Oct 2020 17:33:17 GMT</pubDate>
            <atom:updated>2020-10-27T19:35:04.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*fgRnkJDmwL227IK0QIOAIA.png" /></figure><h3>Introduction:</h3><p>The field of genetics is seeing a lot of attention in AI these days. We have seen breakthroughs happening in scientific research lately but most people cannot make head or tails of how to even begin understanding this field.</p><p>A <strong>genetic algorithm</strong> is a search heuristic that is inspired by <strong><em>Charles Darwin’s </em></strong>theory of natural evolution. This algorithm reflects the process of natural selection where the fittest individuals are selected for reproduction in order to produce offspring of the next generation.</p><p><strong>Genetic algorithm</strong> is a heuristic, <a href="https://en.wikipedia.org/wiki/Derivative-free_optimization"><strong>derivative-free optimization</strong></a> technique involving iterative search procedures which reflects the process of natural selection where the fittest individuals are selected for reproduction in order to produce offspring of the next generation.</p><p>It basically uses biologically inspired operators such as <strong>mutation </strong>, <strong>crossover </strong>and <strong>selection</strong>.</p><p>It belongs to the larger class of <a href="https://en.wikipedia.org/wiki/Evolutionary_algorithm#:~:text=In%20computational%20intelligence%20(CI)%2C,mutation%2C%20recombination%2C%20and%20selection."><strong>evolutionary algorithms</strong></a>.</p><h3>Components of Genetic Algorithm:</h3><ol><li>Initial Population</li><li>Fitness Function</li><li>Selection</li><li>Crossover</li><li>Mutation</li></ol><h4>Initial Population:</h4><p>The process begins with a set of individuals which is called a <strong>Population</strong>. Each individual is a solution to the problem you want to solve.</p><p>An individual is characterized by a set of parameters (variables) known as <strong>Genes</strong>. Genes are joined into a string to form a <strong>Chromosome</strong> (solution).</p><p>In a genetic algorithm, the set of genes of an individual is represented using a string, in terms of an alphabet. Usually, binary values are used (string of 1s and 0s). We say that we encode the genes in a chromosome.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*uF8qdVyC3vIVEyMJTQcVLA.png" /></figure><h4>Fitness and Objective Function:</h4><p>The <strong>fitness function</strong> determines how fit an individual is (the ability of an individual to compete with other individuals). It gives a <strong>fitness score</strong> to each individual. The probability that an individual will be selected for reproduction is based on its fitness score.</p><p>The <strong>objective function</strong> is the function being optimized while the fitness function is what is used to guide the optimization.</p><p>A <strong>fitness function</strong> is a particular type of objective function that is designed to guide the genetic algorithm towards optimal solution.</p><h4>Selection:</h4><p>The Focus of the selection step is to select the <strong>fittest</strong> individuals to pass their genes to the next generation.</p><p>Two pairs of individuals(parents) are selected on their <strong>fitness scores</strong>.</p><p>Individuals with high fitness have more chance to be selected for reproduction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*XFQ3uPr4njeOFwFkuJtMaQ.png" /><figcaption>Various types of selection</figcaption></figure><h4>Elitism:</h4><p><strong>Elitism</strong> involves copying a small proportion of the <strong>fittest</strong> candidates, unchanged, into the next generation.</p><p>This strategy is known as <strong>elitist selection</strong> and guarantees that the solution quality obtained by the <strong>genetic algorithm</strong> will not decrease from one generation to the next.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UTbIu-8fjIe8DcjJyn3BPQ.png" /><figcaption>Example of Elitism</figcaption></figure><h4>Roulette Wheel Selection:</h4><p>Here the better individual gets higher chance and chances are proportional to the fitness.</p><p><strong>Roulette Technique:</strong></p><ol><li>Each individual is assigned to a part of the wheel based on its <strong>fitness</strong>.</li><li>Spin the wheel <strong>k times</strong> to select the best individuals.</li><li><strong>Fitness individual</strong> has the largest share of the <strong>roulette wheel</strong> and <strong>weakest individual</strong> has the smallest share of the <strong>roulette wheel</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*26WgMY5r9ZsDSvV6qOlViQ.png" /><figcaption>Example of Roulette Selection</figcaption></figure><h4>Tournament Selection:</h4><p>Several <strong>tournaments</strong> are held between the individuals of <strong>current generation</strong>.</p><p>A group of n(n is the tournament size) individuals are chosen randomly from the current population and the one with the <strong>best fitness</strong> is selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kiVjYbGzM_NVw3hb3laAkg.png" /><figcaption>Example of Tournament Selection</figcaption></figure><h4>Crossover:</h4><p><strong>Crossover</strong>, also called <strong>recombination</strong>, is a <strong>genetic operator</strong> used to combine the <strong>genetic information</strong> of two parents to generate new offspring.</p><p><strong>Cr</strong> is called the <strong>crossover rate</strong>. If the population size is 10 and Cr is 0.8; then 80% that is, 8 offspring(new chromosomes) are made by crossover.</p><p>If it is 0%, crossover operation will not performed at all(direct copy).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gheEqvfdN0yqTXd2Mz0yFw.png" /><figcaption>Example of Crossover</figcaption></figure><h4>Mutation:</h4><p><strong>Mutation</strong> is a genetic operator used to maintain genetic diversity from one generation of a population of <strong>genetic algorithm</strong> chromosomes to the next.</p><p><strong>Mutation</strong> alters one or more gene values in a chromosome from its initial state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28kF-kIwkmg3hLDWebjPSw.png" /><figcaption>Example of Mutation</figcaption></figure><h3>Flow Chart of Genetic Algorithm Process:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q-kNDFt1KEPhVS9fO2Nj5g.png" /></figure><h3>Implementation of Genetic Algorithm Using Python:</h3><ol><li>Importing the Libraries:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1wzExbZ0fl9hBB9oWg-UYg.png" /></figure><p>2. Initializing the map procedure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LSwU0DbihMRZsAgIpUw2iQ.png" /><figcaption>Procedure and the print function for printing the population</figcaption></figure><p>3. Initializing the Map function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKKC2yiyBsjZKQGH_SVyqg.png" /></figure><p>4. Initializing the map using complex function in order to get better output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhWj9NPGxK0fNNhpwv1-Vg.png" /></figure><p>5. defining two function one for creating new population and another one for calculating the fitness of the individuals:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wtt_m62RaZKnpikodWmX5w.png" /></figure><p>6. Defining the crossover function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLeQZ5LJG6-dA0Ggoq58YQ.png" /></figure><p>7. Defining the mutation function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cyd9pDCudyqK4z_TPkfUtw.png" /></figure><p>8. Defining function for generating a new member and scoring the population:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RtTZ9KRDX7XbzhW2ORXAxQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQVgB2XQIDodHP5VE3HNZQ.png" /></figure><p>9. Defining the function pick mate for selecting the individual on the basis of there scores</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INYApUAjUSLbSyrfr5x9Yg.png" /></figure><p>10. Defining the main function and function for plotting the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*urukA6YHZyKKpN8yTcfYoQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y_lUDNtfKnS_j378NZVSDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O0s0Bsg-L_SEmR1LRlwwJA.png" /></figure><p>11. Visualizing the plots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3TiTEMp7MHsptLxv5aw5qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kiD62c-zTnSOmfMHs4VMVw.png" /></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/Genetic_Algorithm_Implementation"><strong>github repository</strong></a>.</p><p><strong>Closing Note: </strong>I hope this blog will help you in learning <strong>genetic algorithm</strong> in a better way.</p><p>I wanted to thank my mentor <strong>Mr Rajdeep Chatterjee</strong> for guiding me through out this project and for providing me all the necessary resources required to carry out this project smoothly. It was a great experience working with such a great personality. Anyone wanted to know more about my mentor can visit his <a href="https://www.linkedin.com/in/rajdeep-chatterjee-60352325/"><strong>linkedin profile</strong></a>. If anyone wanted to know about his <strong>research work</strong> can visit his <a href="https://www.researchgate.net/profile/Rajdeep_Chatterjee2"><strong>Research Gate profile</strong></a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5bea51dd969" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/genetic-algorithm-b5bea51dd969">Genetic Algorithm</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bitcoin Cryptocurrency Price Visualization]]></title>
            <link>https://medium.com/backyard-programmers/bitcoin-cryptocurrency-price-visualization-4640ba429036?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4640ba429036</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Sat, 03 Oct 2020 22:09:55 GMT</pubDate>
            <atom:updated>2020-10-23T17:35:27.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*5csfMsCXrf6l_z5owq3ldA.png" /></figure><h3>Introduction:</h3><p><strong>Cryptocurrencies </strong>are distributed digital assets , in which currency is not held in digital form. It allows for speedy transactions between different parties. Cryptocurrency is not a crypto coin , it is a name given to cryptographic accounting unit. Financial transactions in these units are secured by cryptography. The most famous cryptocurrency — Bitcoin emerged after 2008 global monetary crisis. Many cryptocurrencies have been launched after bitcoin.</p><h3>BitCoin:</h3><p>Bitcoin is a cryptocurrency invented in 2008 by an unknown person or group of people using the name <strong>Satoshi Nakamoto </strong>and started in 2009 when its implementation was released as open-source software.</p><p>Bitcoin uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. <strong>Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part</strong>. Through many of its unique properties, Bitcoin allows exciting uses that could not be covered by any previous payment system.</p><p>Bitcoin has set the trend for investors to put their money and trust in the cryptocurrency over the past few years and no doubt that it is for the long run.</p><p>There is a list of Bitcoin related data such as the historical prices in USD or other currencies, transaction volumes, miners’ revenue, etc. available on <a href="https://www.quandl.com/collections/markets/bitcoin-data">this page</a> at <strong>Quandl</strong>. Quandl is “a marketplace for financial, economic and alternative data delivered in modern formats for today’s analysts, including Python, Excel, Matlab, R, and via our API.”</p><h3>Lets Start Visualization of Bitcoin Price:</h3><ol><li>Importing The Libraries:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OlWGvklcNV6b5CimegF-Nw.png" /><figcaption>Don’t forget to install the essential libraries required for Visualization before Importing</figcaption></figure><p>2. Calling The API for the Visualization of Prices from Quandl:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVI06oIuSV9vn10LfRx92g.png" /></figure><p>3. Fetching the data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ue1ntMWes6Bknewe4mzPyg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rugo0OHF3ARVMz-g8zh6kg.png" /><figcaption>Printing the Fetched Data</figcaption></figure><p>4. Plotting the Bitcoin Data Fetched:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLLY3ZzkX3UAQ1S-Dq5UcA.png" /></figure><p>5. Getting Data from Multiple Exchanges</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vt1CKVPIs0BHzC2N19A-SQ.png" /><figcaption>Printing exchanges of COINBASE , BITSTAMP , ITBIT</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mlCV5qMOWCTc4MuikKuu4w.png" /><figcaption>Merging all the exchanges and printing them</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xah--VUS3ISd7029alG7iw.png" /><figcaption>Code for the Plot of all the Merged Exchanges</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jk_K0ALFn86SmUim0GRm6w.png" /><figcaption>Plot of all merged exchanges</figcaption></figure><p>6. Averaging and Visualizing our Bitcoin Prices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZ6GQjvV09kFFhj49fGGfQ.png" /><figcaption>Code for Averaging the Prices</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amlxYdHgn0lF_ZxOvbVLWw.png" /><figcaption>Plot of the Averaged prices which is more smooth then above plot</figcaption></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/Bitcoin-Cryptocurrency-Price-Visualization">github repository</a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><p><strong>Closing Note: </strong>I hope this blog will help you all in Visualizing the Prices of the Bitcoin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4640ba429036" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/bitcoin-cryptocurrency-price-visualization-4640ba429036">Bitcoin Cryptocurrency Price Visualization</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sentiment Analysis of Stock  News Using VADER]]></title>
            <link>https://medium.com/backyard-programmers/sentiment-analysis-of-stock-news-using-vader-5ba554d7cc19?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ba554d7cc19</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Sat, 29 Aug 2020 06:27:03 GMT</pubDate>
            <atom:updated>2020-10-23T17:35:59.691Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sentiment Analysis of Stock News Using VADER</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*NTIyFqET1LSzHRPYIPH4xQ.png" /></figure><h3>What is Sentiment Analysis???</h3><p>Sentiment Analysis, or <strong>Opinion Mining, </strong>is a sub-field of <a href="https://en.wikipedia.org/wiki/Natural_language_processing">Natural Language Processing (NLP)</a> that tries to identify and extract opinions within a given text. The aim of sentiment analysis is to gauge the attitude, sentiments, evaluations, attitudes and emotions of a speaker/writer based on the computational treatment of subjectivity in a text.</p><p>Sentiment analysis is a machine learning technique that detects polarity (e.g. a <em>positive</em> or <em>negative</em> opinion) within text, whether a whole document, paragraph, sentence, or clause.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*iEDGWlFUvWjZbZNy4iSxIQ.png" /><figcaption>Example Of Working Of Sentiment Analysis</figcaption></figure><h3>Why is Sentiment Analysis so important??</h3><p>Businesses today are heavily dependent on data. Majority of this data however, is unstructured text coming from sources like <strong>emails, chats, social media, surveys, articles, and documents</strong>. The micro-blogging content coming from <strong>Twitter</strong> and<strong> Facebook</strong> poses serious challenges, not only because of the amount of data involved, but also because of the kind of language used in them to express sentiments, i.e., short forms, memes and emoticons.</p><p>Understanding people’s emotions is essential for businesses since customers are able to express their thoughts and feelings more openly than ever before. By automatically analyzing customer feedback, from survey responses to social media conversations, brands are able to listen attentively to their customers, and tailor products and services to meet their needs.</p><p>Sentiment Analysis is also useful for practitioners and researchers, especially in fields like sociology, marketing, advertising, psychology, economics, and political science, which rely a lot on human-computer interaction data.</p><h3>Why Sometime Sentiment Analysis Becomes Hard to Perform??</h3><p>Though it may seem easy on paper, Sentiment Analysis is actually a tricky subject. There are various reasons for that:</p><ul><li>Understanding emotions through text are not always easy. Sometimes even humans can get misled, so expecting a 100% accuracy from a computer is like demanding something which is completely impossible.</li><li>Computers aren’t too comfortable in comprehending<strong> Figurative Speech</strong>. Figurative language uses words in a way that deviates from their conventionally accepted definitions in order to convey a more complicated meaning or heightened effect. Use of similes, metaphors, etc qualify for a figurative speech. Let us understand it better with an example.</li></ul><blockquote><em>“The best I can say about the movie is that it was interesting.”</em></blockquote><p>Here, the word <strong>’interesting’</strong> does not necessarily convey positive sentiment and can be confusing for algorithms.</p><ul><li>Heavy use of emoticons and slangs with sentiment values in social media texts like that of Twitter and Facebook also makes text analysis difficult. For example a <strong>“ :)”</strong> denotes a smiley and generally refers to positive sentiment while<strong> “:(”</strong> denotes a negative sentiment on the other hand. Also, acronyms like <strong>“LOL“, ”OMG”</strong> and commonly used slangs like <strong>“Nah”, “meh”, ”giggly” </strong>etc are also strong indicators of some sort of sentiment in a sentence.</li></ul><h3>VADER Sentiment Analysis</h3><p><a href="https://github.com/cjhutto/vaderSentiment"><strong>VADER</strong></a> (<strong>Valence Aware Dictionary and sEntiment Reasoner</strong>) is a lexicon and rule-based sentiment analysis tool that is<strong> <em>specifically attuned to sentiments expressed in social media</em></strong>. VADER uses a combination of A sentiment lexicon is a list of lexical features (e.g., words) which are generally labelled according to their semantic orientation as either positive or negative.</p><p>VADER has been found to be quite successful when dealing with social media texts, NY Times editorials, movie reviews, and product reviews. This is because VADER not only tells <strong>about</strong> the Positivity and Negativity score but also tells us about <strong>how positive or negative a sentiment is</strong>.</p><h3>Advantages Of Using VADER</h3><p>VADER has a lot of advantages over traditional methods of Sentiment Analysis, including:</p><ul><li>It works exceedingly well on social media type text, yet readily generalizes to multiple domains</li><li>It<strong> doesn’t require any training data</strong> but is constructed from a generalizable, valence-based, human-curated gold standard sentiment lexicon</li><li>It is fast enough to be used online with streaming data, and</li><li>It does not severely suffer from a speed-performance tradeoff.</li></ul><h3>Let’s begin with the code:</h3><ol><li>Importing the libraries required for our Sentiment Analysis</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pkpDNFZh_8_8-TkjVIgodA.png" /></figure><p>2. Parsing Finviz Article Data with BeautifulSoup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBX5xFp5NxD-jwSW-uw2Cg.png" /></figure><p>3. Manipulating Article Data with Pandas</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0hvJl9ELpm9ejmudCYOxGg.png" /><figcaption>For Amazon Only</figcaption></figure><p>4. Parsing Data for all the Tickers(Amazon,Google,Face Book)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bBW1xVLCoJcfqMBla1VXFg.png" /><figcaption>Accessing all Stock news with there date and time</figcaption></figure><p>5. Applying Sentiment Analysis on Article Headlines</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yec6aKDsQGavEakMkxpo1g.png" /></figure><p>6. Best part of our Project that is Visualization of Sentiment Analysis with MatPlotLib</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkGIegOUX4MZ84aSnn2KYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*1jzIkogGUbJJliVPE2zscg.png" /><figcaption>Sentiment Analysis of Stock News for Amazon,Google,Face Book</figcaption></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/SENTIMENT_ANALYSIS_OF_STOCK_NEWS">github repository</a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><p><strong>Closing Note: </strong>I hope this blog will help you to build your own Sentiment Analysis System.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ba554d7cc19" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/sentiment-analysis-of-stock-news-using-vader-5ba554d7cc19">Sentiment Analysis of Stock  News Using VADER</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Recognizing Handwritten Digits with Python]]></title>
            <link>https://medium.com/backyard-programmers/recognizing-handwritten-digits-with-python-c0184908111b?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0184908111b</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Thu, 20 Aug 2020 20:58:37 GMT</pubDate>
            <atom:updated>2020-10-23T17:36:31.558Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*cc3ch1xoqUtBzt-6fBjLWw.png" /></figure><h3>Introduction:</h3><p>Everyday, developers are working hard on machines to make them more smart and intelligent by using machine learning and deep learning techniques so that they can perform tasks similar to humans. With the help of these techniques human effort can be reduced in recognizing, learning, predictions and many other areas.</p><blockquote><em>The ability of computers to recognize human handwritten digits is known as </em><strong><em>handwritten digit recognition</em></strong><em> from sources such as paper documents, images, touch-screens etc.</em></blockquote><p>In this article you will discover how to develop a deep learning model to achieve high performance on the handwritten digit recognition task using the <a href="https://www.openml.org/d/554"><strong>MNIST</strong> dataset</a>.</p><h3>Problem Statement:</h3><p>It is easy for the human to perform a task accurately by practicing it repeatedly and memorizing it for the next time. Human brain can process and analyse images easily. Also, recognize the different elements present in the images.</p><blockquote><em>The challenge in handwritten digit recognition is mainly caused by the writing style variations of every single individual. So, it is not easy for the machine to recognize the handwritten digits accurately like the humans do. Hence, robust feature extraction is very important to improve the performance of machines.</em></blockquote><h3>MNIST Dataset:</h3><p>The MNIST dataset (Modified National Institute of Standards and Technology) is a large dataset of handwritten digits that is widely used for training and testing in the field of machine learning and deep learning.</p><blockquote><em>The MNIST dataset contains 70,000 training images and 10,000 testing images of handwritten digits from zero to nine(0 to 9). So, the MNIST dataset has 10 different classes. Each image is represented as a 28×28 matrix where each cell contains grayscale pixel value.</em></blockquote><h3>So, Let’s Start :</h3><ol><li>Importing the Libraries:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ex2DcwfrXHNX_Gfz9PJEhw.png" /></figure><p>2. Loading the <a href="https://www.openml.org/d/554">MNIST dataset</a> .This may take some time as data set is too large.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vA79B1HNgYhO16Hto7lkkA.png" /></figure><p>3. Printing the handwritten Digits from the Data set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-Wt1J8wHuhR4TfFNpyKbA.png" /></figure><p>4. Splitting the data set into Training set and Test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0cNgM-F-o--gRjMiOi0PNw.png" /></figure><p>5. Now we will Apply Logistic Regression to our Training set and will predict the score of our model. After applying Logistic Regression we will get error message just ignore it as our data set is too large it exceeds the MAX limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0Wa38NbvJEf5PEUJ_-CRg.png" /></figure><p>6. Most interesting part Prediction of Digits. I am attaching some of Digit predictions of the Model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZyKMC9Y9wuFIyQcB8MWJXA.png" /><figcaption>TESTING 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dr9V3WBKIuWZVue9seuVwQ.png" /><figcaption>TESTING 2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PMCfsosiD0zLUdvB_RrWyA.png" /><figcaption>TESTING 3</figcaption></figure><p>7. Making the Confusion Matrix of our Model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiRahjs1MOltFzma_Vq1ww.png" /><figcaption>PRINTING THE MATRIX</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MKOy7jxAD3a-ujxdf9TI2A.png" /><figcaption>CODE FOR PRINTING CONFUSION MATRIX</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*e8MFDUkHAPKtFS7OlWvrmw.png" /><figcaption>CONFUSION MATRIX</figcaption></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/RECOGNIZING_HANDWRITTEN_DIGITS_IN_PYTHON">github repository</a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><p><strong>Closing Note: </strong>I hope this blog will help you to build your own Handwritten Digit Recognizing system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0184908111b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/recognizing-handwritten-digits-with-python-c0184908111b">Recognizing Handwritten Digits with Python</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Face Detection Using OpenCV(Python)]]></title>
            <link>https://medium.com/backyard-programmers/face-detection-using-opencv-python-db764b40c94a?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/db764b40c94a</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Mon, 17 Aug 2020 20:29:17 GMT</pubDate>
            <atom:updated>2020-11-22T05:41:44.669Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L6dJ33tUCaDnpYGTOgpgVA.png" /></figure><p>Computer vision is all the rage in the machine learning and deep learning community these days. And one of the most popular applications of this domain is face detection.</p><h3>What is Face Detection???</h3><p>Face detection is the ability of computer technology to identify people’s faces within digital images. Face detection applications employ algorithms focused on detecting human faces within larger images that may contain landscapes, objects etc.</p><p>In order to work, face detection applications use machine learning algorithms to detect human faces within images of any size. The larger images might contain numerous objects that aren’t facing such as landscapes, objects, animals, buildings and other parts of humans (e.g. legs, shoulders and arms).</p><p>Facial detection/recognition technology was previously associated with only security sector but today there is active expansion into other industries including retail, marketing, healthcare etc.</p><h3>How Face Detection Works???</h3><p>While the process is somewhat complex, face detection algorithms often begin by searching for human eyes. Eyes constitute what is known as a valley region and are one of the easiest features to detect. Once eyes are detected, the algorithm might then attempt to detect facial regions including eyebrows, the mouth, nose, nostrils, and the iris. Once the algorithm surmises that it has detected a facial region, it can then apply additional tests to validate whether it has, in fact, detected a face.</p><h3>OpenCV:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*Hc5DGYzsL1HaBf6TI5dAuw.png" /></figure><p>OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning library. This was built to give a common structure for computer vision applications and to influence the use of machine interpretation in the commercial products like facial recognition which is extensively use in today’s world. OpenCV has more than 2,500 optimized algorithms. These algorithm can be used to detect and identify faces, objects, track moving objects in a video or in an image, follow eye movements etc.</p><p>OpenCV has been written in C++ and has templated interface that work with STL containers (Standard Template Library: it is a set of C++ template classes to provide common programming data structure and functions like list, array, stack etc). OpenCV has C++, Python, Java and Matlab interfaces and supports Windows, Linux, Mac OS and also Android.</p><h3>Haar Cascade:</h3><p>A Haar Cascade is a classifier which is used to detect the object for which it has been trained for. The Haar cascade is trained by superimposing the positive image over a set of images. This type of training is generally done on a server and on various stages. Better results are obtained by using high quality images and increasing the amount of stages for which the classifier is trained for. This cascade makes it easier to build a model. One just needs to pre-define the Haar cascade which are available on <a href="https://github.com/opencv/opencv/tree/master/data/haarcascades">github repository</a>. Moreover one can make their own cascade file.</p><h3>How to develop your own Haar Cascade??</h3><ol><li>Collect positive and negative images related to detection.For example for Face Detection positive images are the faces and negative images are the background images like lamppost,car,etc.Refer to my <a href="https://github.com/akash-ranjan8/FACE_DETECTION">github repository </a>for downloading samples.</li><li>After completion of first step use object_maker.bat for saving the dimensions of faces . Press Space to save and Enter for next image.</li><li>Run samples_creation.bat to get a file in folder vector after completion of step 2.</li><li>Run harrtraining.bat to get 0 to n-1 Cascades.</li><li>Copy Cascades to Cascade2xml/data folder and run covert.bat to get your own Harr Cascade in XML format.</li><li>Your Detector is ready.</li></ol><h3>So, Let’s Start :</h3><ol><li>Installing required Libraries:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anAQLe8O6NMnWcwyx6Gtgw.png" /></figure><p>2. Importing the Libraries:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FxWDcnevLYhsbg9M4DwB8w.png" /></figure><p>3. Reading the image. Here firstly i am creating a my Haar Cascade object,image object, and then converting the colored image to gray Scale and printing its dimension of face.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jbvfj8UwuUEZZZa6eex2kg.png" /></figure><p>4. Detecting the Face by making the rectangle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1f4XkCPkiMBQzFgXhlICOA.png" /></figure><h3>Original Vs Detected Image:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*iF6Z1INNshEYKjCtn6KFTA.png" /><figcaption>TESTING 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/967/1*BdxQU0TqHlBWgKG-SWHH-Q.png" /><figcaption>TESTING 2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*CBPMAdpfBj850g3l84u4Fw.png" /><figcaption>TESTING 3</figcaption></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/FACE_DETECTION">github repository</a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><p><strong>Closing Note: </strong>I hope this blog will help you to build your own Face Detection system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db764b40c94a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/face-detection-using-opencv-python-db764b40c94a">Face Detection Using OpenCV(Python)</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Movie Recommendation System-Content Filtering]]></title>
            <link>https://medium.com/backyard-programmers/movie-recommendation-system-content-filtering-aa557ad29f9a?source=rss-65c38493807d------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa557ad29f9a</guid>
            <dc:creator><![CDATA[AKASH RANJAN]]></dc:creator>
            <pubDate>Thu, 13 Aug 2020 20:13:27 GMT</pubDate>
            <atom:updated>2020-11-22T05:38:23.370Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlpWym0aQiq7F9OCaasP0w.png" /></figure><p>For a long time, I have been thinking about how shopping websites like Flipkart or Amazon or movie based platforms like Netflix or even on medium suggest anything based on user interest.</p><h4>In this blog post, I will build a movie recommendation system using <a href="https://github.com/akash-ranjan8/MOVIE_RECOMMENDER_SYSTEM/blob/master/movie_dataset.csv">The Movie Dataset</a></h4><p>Hearing to what Google has to say about it.</p><blockquote><em>A </em><strong><em>recommender system</em></strong><em> or a </em><strong><em>recommendation system</em></strong><em> (sometimes replacing “system” with a synonym such as platform or engine) is a subclass of information filtering system that seeks to predict the “rating” or “preference” a user would give to an item</em></blockquote><blockquote><em>and putting in a simple language “</em>a recommendation system suggest anything relevant based on the used interest<em>”</em></blockquote><p>The recommendation system is classified into two type <strong>Content-Based</strong> <strong>and</strong> <strong>Collaborative based </strong>recommendation system. Let’s try to understand each one by one.</p><blockquote><em>The idea behind </em><strong><em>Content-based (cognitive filtering) </em></strong><em>recommendation system is to recommend an item based on a comparison between the content of the items and a user profile.In simple words,I may get recommendation for a movie based on the description of other movies.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUM09RwZ49Bl4fdzl5Y8eQ.png" /></figure><blockquote><em>The theory behind collaborative filtering to work with collaboration with user or movie id.For example, there are two user </em><strong><em>A </em></strong><em>and </em><strong><em>B, user A </em></strong><em>likes movie </em><strong>P</strong><em>,</em><strong><em>Q,R,S</em></strong><em> and </em><strong><em>user B </em></strong><em>like movies </em><strong><em>Q,R,S</em></strong><em>,</em><strong>T</strong><em>. Since movies Q, R and S are similar to both user, therefore, movie P will be recommended to user B and movie T will be recommended to used A.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7M4TAmpaP1E1gq0M0oRlw.png" /></figure><p>Starting with understanding of data first. I have used <a href="https://github.com/akash-ranjan8/MOVIE_RECOMMENDER_SYSTEM/blob/master/movie_dataset.csv">The Movie Dataset</a> which has data of around 5000 movies describing there various features.Before we dive in code lets try to figure out our approach towards the solution. For the ease of understanding, I have tried my hands on content filtering approach on the same data set.</p><p>For content-based filtering, the approach is relatively simple we have to just convert the words or text in vector form and to find the closest recommendation to our given movie input title using cosine similarity.</p><p>Let’s begin with the code.</p><ol><li>Importing the Libraries which we will use for our recommender system</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*Ur76ZCvtDAegMXFSadSItQ.png" /></figure><p>2. Defining the Helper function one is for getting the title from the index and another function is to return index from the title</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3T5yUSdr1H4Pqp-_r3hzQ.png" /></figure><p>3. Reading the dataset. For reading two procedures can be followed firstly directly copying the link(raw data) of dataset in pd.read_csv or by uploading it to the google colab. I had uploaded the dataset in google colab then used it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R95_di_merBSGqip0leyWg.png" /></figure><p>4. Selecting the features for Movie recommendation system and combining it into a column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SChX862aWZogqanptYpxoA.png" /></figure><p>5. Creating the count matrix of the combined column and computing the cosine Similarity based on count matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uWVFj7T1uK-n_KGvOmZ-jQ.png" /></figure><p>6. Get the index of the movie from its title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45QuWbLkIJK0rB4K43NuBA.png" /></figure><p>7. Get a list of similar movies in descending order of similarity score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nkExPk_Re-PCUxmJ4e2pGQ.png" /></figure><p>8. Final step printing the similar movies as per user’s choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NqWBAzf95yHRZNUN52uVVg.png" /><figcaption>Movies similar to Avatar</figcaption></figure><p>The source code of this is available on my <a href="https://github.com/akash-ranjan8/MOVIE_RECOMMENDER_SYSTEM">github repository</a>.</p><p>For any queries related to my project contact me over my email id: <strong>powerakash8@gmail.com</strong></p><p><strong>Closing Note: </strong>I hope this blog will help you to build your own recommendation system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa557ad29f9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/backyard-programmers/movie-recommendation-system-content-filtering-aa557ad29f9a">Movie Recommendation System-Content Filtering</a> was originally published in <a href="https://medium.com/backyard-programmers">Backyard Programmers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>