<?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 Priyanka Goel on Medium]]></title>
        <description><![CDATA[Stories by Priyanka Goel on Medium]]></description>
        <link>https://medium.com/@gunjan.priyanka29?source=rss-2038c076f1d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-we5n66pxuugF2J5g1aACQ.jpeg</url>
            <title>Stories by Priyanka Goel on Medium</title>
            <link>https://medium.com/@gunjan.priyanka29?source=rss-2038c076f1d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 16:03:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gunjan.priyanka29/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[Performance measurement (Part-II)]]></title>
            <link>https://medium.com/swlh/performance-measurement-part-ii-245d770e2351?source=rss-2038c076f1d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/245d770e2351</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[performance-measurement]]></category>
            <category><![CDATA[precision]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[recall]]></category>
            <dc:creator><![CDATA[Priyanka Goel]]></dc:creator>
            <pubDate>Sun, 13 Sep 2020 17:01:40 GMT</pubDate>
            <atom:updated>2020-09-13T17:01:40.484Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Understanding precision, recall, F1 score, Macro ,micro averaging methods and roc-auc curve for measuring the performance of machine learning models.</blockquote><h3><strong>Table of content:</strong></h3><ol><li>Precision</li><li>Recall</li><li>F1 score</li><li>Micro Averaging Method</li><li>Macro Averaging Method</li><li>ROC-AUC curve</li></ol><p>As we have understood what is confusion matrix and why do we need it in our previous blog. If you have not yet visited it,please check it out <a href="https://medium.com/@gunjan.priyanka29/performance-measurement-part-i-11a90e8208b2">here</a>.</p><p>Let us discuss about some other terminologies in detail-</p><h3><strong>Precision</strong></h3><p>It tells us of all the points our model declared to be positive, what percentage of them are actually positive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*DYMpPjfgAKTD827wZm10LA.png" /><figcaption><a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.colabug.com%2F2019%2F0608%2F6386206%2F&amp;psig=AOvVaw23GG_cTOewu0w0tFcijJId&amp;ust=1600025757130000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCNCk5tOu5OsCFQAAAAAdAAAAABAE">Precision</a></figcaption></figure><h3><strong>Recall</strong></h3><p>It tells us of all the actual positive points , what percentage of them are actually predicted as positive by our model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*i-w3tYGx9DwDEsfCJiSNPw.png" /><figcaption><a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.colabug.com%2F2019%2F0608%2F6386206%2F&amp;psig=AOvVaw23GG_cTOewu0w0tFcijJId&amp;ust=1600025757130000&amp;source=images&amp;cd=vfe&amp;ved=0CAIQjRxqFwoTCNCk5tOu5OsCFQAAAAAdAAAAABAE">Recall</a></figcaption></figure><h3><strong>F1 Score</strong></h3><p>It conveys the balance between precision and recall. In simple words we can say that it is actually the harmonic mean of the two.</p><p>2*((precision*recall)/(precision+recall))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*obwzNNvO2ulGq8OqZQ1PdQ.png" /><figcaption><a href="https://sebastianraschka.com/faq/docs/multiclass-metric.html">F1 Score</a></figcaption></figure><p>For multi-class classification problem we have <strong>micro and macro averaging methods.</strong></p><p>A macro-average will compute the metric independently for each class and then take the average (hence treating all classes equally), whereas a micro-average will aggregate the contributions of all classes to compute the average metric.</p><p>Let us understand them one by one.</p><h3><strong>Micro Averaging method</strong></h3><p>It is calculated my taking out the sum of all the true positives, false positives,false negatives of all the classes and then calculating the over all precision and recall.</p><p>Let us suppose we have 3 classes with class label as 1,2,3.</p><p>Then we calculate TP-1,TP-2,TP-3 and similarly we calculate FP-1,FP-2,FP-3 and FN-1,FN-2,FN-3 add them and now use the total TP,FP and FN for calculating precision and recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*I96QbO3VCU1eizW7YlAh7Q.png" /><figcaption><a href="https://peltarion.com/knowledge-center/documentation/evaluation-view/classification-loss-metrics/micro-f1-score">Micro F1 score</a></figcaption></figure><h3><strong>Macro Averaging Method</strong></h3><p>It is calculated by taking out the precision and recall for each class separately in one vs all way and then take out the average of all precision and recall values to find the F1 score.</p><p>using the same example as above-</p><p>We can calculate precision for class 1 ,2 and 3 separately and recall also in the same manner and then-</p><p><strong>Total-Precision</strong> = (precision-1+precision-2+precision-3)/3</p><p><strong>Total-Recall </strong>= (Recall-1+Recall-2+Recall-3)/3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*2FtsNZPmgmvjrr4u72_4Zw.png" /></figure><h3><strong>AUC-ROC Curve</strong></h3><p><strong>ROC curve</strong> stands for <strong>receiver operating characteristic curve.</strong></p><p>It is a graph showing the performance of a classification model at all classification thresholds.</p><p>An ROC curve plots TPR vs. FPR at different classification thresholds where as AUC represents degree or measure of separability.</p><p>Here AUC stands for <strong>area under the curve.</strong></p><p>Higher the AUC, better the model is at predicting positive class as positive and negative class as negative.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*zgXanRgBSo-jiO-ef4nhBg.jpeg" /><figcaption>ROC-AUC curve</figcaption></figure><p>Hope you all are clear with performance measurement.</p><h3><strong>References :</strong></h3><p><a href="http://gim.unmc.edu/dxtests/roc3.htm">The Area Under an ROC Curve</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=245d770e2351" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/performance-measurement-part-ii-245d770e2351">Performance measurement (Part-II)</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance measurement (Part-I)]]></title>
            <link>https://medium.com/swlh/performance-measurement-part-i-11a90e8208b2?source=rss-2038c076f1d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/11a90e8208b2</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[confusion-matrix]]></category>
            <category><![CDATA[machine-learning-python]]></category>
            <category><![CDATA[performance-measurement]]></category>
            <dc:creator><![CDATA[Priyanka Goel]]></dc:creator>
            <pubDate>Sun, 13 Sep 2020 16:54:20 GMT</pubDate>
            <atom:updated>2020-09-13T17:13:26.603Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Confusion matrix for measuring the performance of Machine learning models.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*qLW7m0iGQPGdBk_1uB9Hhw.png" /></figure><h3>Performance measures</h3><p>Machine learning is all about classifying data-points to one or the other class.</p><p>When ever we use any particular algorithm it do give us some result after passing test data-set.</p><p>But how to evaluate the performance of the algorithm? How well it worked for us?</p><p>Simple answer for this could be to find out the accuracy for it.</p><p>but it is not always good to use accuracy for the performance measure as the results could be miss-leading and we might get accuracy as high as 99% for a highly biased model.</p><p>So if not accuracy then what should we use for performance measure?</p><p>better way to evaluate the performance of a classifier is to look at the <strong>confusion matrix.</strong></p><h3><strong>Confusion Matrix</strong></h3><p>A <strong>confusion matrix</strong> is a tabular summary of the number of correct and incorrect predictions made by a classifier.</p><p>Refer below diagram to understand it more clearly-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*VK34q6LrMuRJ915VxXx49Q.png" /><figcaption>Confusion Matrix</figcaption></figure><p>Though the overall idea behind confusion matrix is relatively simple but still the related terminologies can still be confusing.</p><p>Let us understand each one of them with a simple example-</p><p>We have 2 people talking to each other and there could be two possible predicted classes: “yes” and “no”.</p><p>“yes”- when it is predicting a person to be a girl.</p><p>“no”- when it is predicting a person not a girl.</p><p><strong>TP(True Positives) :</strong> Case where our model predicted someone to be a girl and it is actually a girl. In-short for correctly predicted event values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*JehzVBSgGsKnLOdWac9Cwg.jpeg" /><figcaption>True Positive case</figcaption></figure><p><strong>TN(True Negatives): </strong>When our model predicted someone not a girl and the person is actually not a girl. In-short for correctly predicted no-event values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*akxdpFcQVloZ3jwKV1likQ.jpeg" /><figcaption>True Negative Case</figcaption></figure><p><strong>FP(False Positives):</strong> When our model predicted someone to be a girl but the person is actually not a girl. In-shot for incorrectly predicted event values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*5pD-xKSKOL66o-qoY9ByqA.jpeg" /><figcaption>False Positive case</figcaption></figure><p><strong>FN(False Negatives):</strong> When our model predicted someone not to be a girl but the person is actually a girl. In-short for correctly predicted no-event values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*r_pWvldls8y9fyOgdwHzhQ.jpeg" /><figcaption>False Negative Case</figcaption></figure><p>Now that we are clear with basic terminologies, let us understand few more.</p><p><strong>True Positive Ratio</strong> : It is the division of True Positives(TP) with total number of actual positive point.(TP/P).</p><p><strong>True Negative Ratio </strong>: It is the division of True Negatives(TN) with the total number of actual negative points.(TN/N).</p><p><strong>False Positive ratio</strong> : It is the division of False Positives(FP) with the total number of actual negative points(FP/N).</p><p><strong>False Negative ratio</strong> : It is the division of False Negatives(FN) with the total number of actual positives points(FN/P).</p><p>We should always avoid FNs as these can be really dangerous for real world problems.</p><p>For more information on Precision, Recall, F1 score etc please visit my blog <a href="https://medium.com/@gunjan.priyanka29/performance-measurement-part-ii-245d770e2351">performance measurement (part-II )</a>.</p><h3>References:</h3><p><a href="https://machinelearningmastery.com/confusion-matrix-machine-learning/">What is a Confusion Matrix in Machine Learning - Machine Learning Mastery</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11a90e8208b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/performance-measurement-part-i-11a90e8208b2">Performance measurement (Part-I)</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Classification of Documents Using Convolutional Neural Network(CNN)]]></title>
            <link>https://medium.com/swlh/classification-of-documents-using-convolutional-neural-network-cnn-e0768bb81aad?source=rss-2038c076f1d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0768bb81aad</guid>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[word-embeddings]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Priyanka Goel]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 18:33:09 GMT</pubDate>
            <atom:updated>2020-09-13T19:58:20.318Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Dealing with text data in deep learning with the help of CNN and word embedding.</blockquote><p><strong>Table of content-</strong></p><ol><li>What is document classification</li><li>Preprocessing</li><li>Word Embedding</li><li>Keras Embedding layer</li><li>Tokenizer API</li><li>GloVe: global vectors for word representation</li><li>Model Creation</li><li>Model Summary</li><li>References</li></ol><h3><strong>Document classification</strong></h3><p>Document classification is an example of Machine learning where we classify text based on its content.</p><p>There are two broad categories of Machine learning techniques which can be used for it.</p><p><strong>Supervised leaning</strong> — Where we already have the category to which particular document belongs to. Our model parse through the data during training, maps the function from it.</p><p>Categories are predefined and documents within the training datasets are manually tagged with one or more category labels.After training, the model is smart enough to categorize the new document given.</p><p><strong>Unsupervised learning</strong> — Where we do not have the class label attached to the document and we use ML algorithms to cluster the document which are of same type.</p><p>Refer below diagram for better understanding-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*HZSJHEokVsYMEowMQX5n1g.jpeg" /><figcaption>Document classification</figcaption></figure><h3><strong>Preprocessing</strong></h3><p>Lets suppose we have millions of emails with us and we need to classify to which class each of these email belongs to.</p><p>In real world the data given is never perfect. We need to do preprocessing so as to extract maximum knowledge out of it with out making our model get confused due to extra information given .</p><p>Take out the subject, remove extra details from it and put it in a Data-frame.</p><p>Extract all the Email ids mentioned into the mail and get it into a Data-frame.</p><p>Extract the given text data , preprocess it and put it in a Data-frame.</p><p>Combine all these and we are ready with the desired text to give to our model.</p><p>For more information and code visit my github. Link is at the end of this blog .</p><h3><strong>Word embedding</strong></h3><p><strong>Word Embedding </strong>is a representation of text where words that have the same meaning have a similar representation. In other words it represents words in a coordinate system where related words, based on a corpus of relationships, are placed closer together.</p><p>It is the collective name for a set of language modeling and feature learning techniques in natural language processing (NLP) where words or phrases from the vocabulary are mapped to dense vector of real numbers.</p><p>It is actually an improvement over traditional ways of encoding such as Bag-of-word where each word was represented by a large sparse vector depending upon size of vocabulary it is dealing with.</p><p>In contrast to this, in an embedding, representation of a word is by a dense vector which represents the projection of the word into a continuous vector space.</p><p>The position of a word within the vector space is learned from text and is based on the neighboring words.</p><h3><strong>Keras Embedding layer</strong></h3><p>Keras offers an Embedding layer that can be used for neural networks on text data. It requires that the input data be integer encoded, so that each word is represented by a unique integer. This data preparation step can be performed using the<strong> </strong>Tokenizer API<strong> </strong>also provided with keras.</p><p>This layer can be represented as —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*6bdYplIZSvLMXRAf0jXhDA.png" /><figcaption>Keras Embedding layer</figcaption></figure><p>Where few important arguments are-</p><ol><li><strong>input_dim </strong>— Which specifies the size of the vocabulary in the text data, that means the total unique words in your data is 50.</li><li><strong>output_dim</strong> — Which specifies the size of the word vector you get as the output of the embedding layer.</li><li><strong>input_length </strong>— It is the length of the input sequence. For example if the maximum length of a sentence in a document is 100 then its input length is 100.</li><li><strong>Trainable </strong>— It specifies whether we want to train the embedding layer or not.</li></ol><p>The embedding layer can be used in different ways-</p><ol><li>We use it as a part of deep learning model and this layer learns with the model itself. In such scenarios we give parameter trainable as True.</li><li>We use already pretrained vectors to represent our words which are trained on large datasets.In such scenarios we give parameter trainable as False.</li></ol><p>We will be focusing on how to use the pretrained vector for representing our words and train our complete dataset on it.</p><p>Let us take an example to understand it more deeply-</p><p>suppose we have our dataset which contains few remarks and we need to classify to which class these remarks belong to.</p><p>1 signifies that the remark is good where as 0 signifies it to be bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*gTxRexrPSL9XqV5_pf9ctQ.png" /><figcaption>Given set of data</figcaption></figure><p>The Keras deep learning library provides some basic tools to help us prepare our text data.Text data must be encoded as numbers to be used as input or output for machine learning and deep learning models.</p><p>For this purpose we use Tokenizer API.</p><h3><strong>Tokenizer API</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/201/1*LneVSDCHewrwh4ou9uUxiw.png" /><figcaption>Tokenizer</figcaption></figure><p>Sometimes we want to have some special punctuation to be a part of our analysis thus in that case we can specify only the filters we want to get removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*fHRQRAZmd2BlWewkTI7ydg.png" /><figcaption>Tokenizer along with filters argument</figcaption></figure><p>Our vocabulary is the total number of unique words present in the data-set and Tokenizer represent each word with a unique digit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/145/1*25DBLKCQN29EtwKMJek9Gw.png" /><figcaption>word index dictionary</figcaption></figure><p>So the total vocab size is this case will be 13.</p><p>Now we need to encode our complete data in integer form, where texts_to_sequences is used and then apply padding to make complete data of same length.</p><p>We can pad our data in 2 forms-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*R8BHkGda--cgDf8hr0A85w.png" /><figcaption>Padding is Post</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*CoxO1_-3dRlxv0Y07IDClQ.png" /><figcaption>Padding is Pre</figcaption></figure><p>Now since we are ready with our words lets discuss about the pre trained vectors for word representation and where can we download it from.</p><h3><strong>GloVe : global vectors for word representation</strong></h3><p>GloVe stands for global vectors for word representation. It is an unsupervised learning algorithm developed by Stanford for generating word embedding by aggregating global word-word co-occurrence matrix from a corpus.</p><p>We can download this and can seed the Keras Embedding layer with weights from the pre-trained embedding for the words in our training dataset.</p><p><a href="https://nlp.stanford.edu/projects/glove/">GloVe: Global Vectors for Word Representation</a></p><p>We can download any of the zip file depending upon the requirement. After unzipping the final file I used is “glove.6B.100d.txt”.</p><p>If we try to look inside of this file, it has a vector associated with each word.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*aS_7vFe2LsoRYy0C0CtC7Q.png" /><figcaption>Content of GloVe file</figcaption></figure><p>Now we need to load this entire file and try to fetch words and its corresponding vector representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*sd83AhXSNr4tA-fBOUHNEg.png" /></figure><p>Once this is done, we need to create the embedding matrix for our vocabulary we created using the training dataset and its vector representation will be taken from the GloVe file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*u_i30s5ooXbpE-dIEcc-ww.png" /></figure><h3><strong>Model Creation</strong></h3><p>Once we are all set with our embedding matrix, we will use Keras predefined Embedding layer and give parameter weights as our embedding matrix.</p><p>This embedding layer comes just after the input layer. We can add any number of layers as per our model’s requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*H3yBTbjhJIqcb99EleAUKA.png" /><figcaption>Final model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*XhXX3CjNUBbLJ0wK79vAhQ.png" /><figcaption>Model Summary</figcaption></figure><p>now we can fit the model using fit method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*rWW8ak4oAEFouBS6ibZF6A.png" /></figure><p>Accordingly we can evaluate it and validate it for our test data.</p><p>For more details visit my <a href="https://github.com/priyanka1901."><em>Github</em></a>.</p><h3>References :</h3><ul><li><a href="https://machinelearningmastery.com/use-word-embedding-layers-deep-learning-keras/">How to Use Word Embedding Layers for Deep Learning with Keras - Machine Learning Mastery</a></li><li><a href="https://www.kdnuggets.com/2015/01/text-analysis-101-document-classification.html">Text Analysis 101: Document Classification - KDnuggets</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0768bb81aad" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/classification-of-documents-using-convolutional-neural-network-cnn-e0768bb81aad">Classification of Documents Using Convolutional Neural Network(CNN)</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>