<?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 Kanad Basu, PhD on Medium]]></title>
        <description><![CDATA[Stories by Kanad Basu, PhD on Medium]]></description>
        <link>https://medium.com/@kanad.basu?source=rss-94916ab27d47------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*N_XwHPL_2N3dC3q5HoZNQg@2x.jpeg</url>
            <title>Stories by Kanad Basu, PhD on Medium</title>
            <link>https://medium.com/@kanad.basu?source=rss-94916ab27d47------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 14:51:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kanad.basu/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[How SnackNation is engaging Machine Learning to recommend the perfect snack that you are craving…]]></title>
            <link>https://medium.com/snacknation-engineering/how-snacknation-is-engaging-machine-learning-to-recommend-the-perfect-snack-that-you-are-craving-a89bfa222191?source=rss-94916ab27d47------2</link>
            <guid isPermaLink="false">https://medium.com/p/a89bfa222191</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[recommender-systems]]></category>
            <category><![CDATA[snacks]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <dc:creator><![CDATA[Kanad Basu, PhD]]></dc:creator>
            <pubDate>Wed, 11 Dec 2019 20:37:33 GMT</pubDate>
            <atom:updated>2020-01-13T22:53:38.984Z</atom:updated>
            <content:encoded><![CDATA[<h3>How SnackNation is engaging Machine Learning to recommend the perfect snack that you are craving for</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*71ssxuT7eJY5UziKySQ7wg.jpeg" /></figure><p>At SnackNation we are innovating to explore and understand our members’ preferences to curate the best snack box to make them happy. A major part of SnackNation’s business relies on providing boxes of healthy, high-quality snacks to our customers. As our boxes include 12 different snacks and there are several types of boxes, a fundamental question we must constantly ask ourselves is: “What snacks should we include this month to optimize our members’ satisfaction?”</p><p>Knowing what people want is a very difficult job, if not impossible. Hence, we are putting machine learning to work to better understand our members. In the newer, narrower sense, collaborative filtering is a method of making automatic predictions (filtering) about the interests of a user by collecting preferences or taste information from many users (collaborating).</p><p>We explore data about their preferences and dislikes with our specially designed swap data. Sneak Peek (Swap Your Snacks) is a special feature for our gold members (a special subscription type) where members can swap snacks from their default box with a given list of Favorites each month. The default box is a set with a fixed set of snacks for all our members. They’re great snacks, but that’s not a very personalized approach for our members, so we decided to put data to work.</p><p>During the swapping process, the products our members swap in can be considered as a ‘like’ statement and the products the member swaps out can be considered a ‘dislike’. Moreover, we can consider the products they don’t swap out from our default curation box as tacit, but not significant, approval. There are many ways to take advantage of this past swap data to recommend products that our members will love. This will increase customer satisfaction and reduce churn. We hope to keep happy customers with us for a long time.</p><p>There are many <a href="https://stackabuse.com/creating-a-simple-recommender-system-in-python-using-pandas/">articles</a> on how to build a recommendation engine so I am not going to discuss how to make one. Instead, this article discusses our journey to make a snack recommendation engine particularly designed for SnackNation.</p><p>User-based and Content-based collaborative filtering are very popular methods used to build recommendation engines. Both of them have their advantages and disadvantages. As we have thousands of members and thousands of different products to choose from, neither user-based collaborative filtering nor content-based collaborative filtering has any overwhelming advantages. Let me explain the two processes in a little more details:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7fN5onIhXNsDNcteVeymFg.png" /><figcaption>Above is a very simple illustration of how recommender systems work in the context of an e-commerce site.</figcaption></figure><p><strong>User-based collaborative filtering:</strong> The whole concept of user-based collaborating filtering is trying to find similar snackers based on their snack preferences. If member A and B have similar kind of snacking likes and dislikes based on their historical swap data, we can calculate a numerical matrix that would represent a similarity score. If the score is very high, then a product which was liked by member A would be recommended to member B and vice-versa. Very straight forward rule, right? But the problem with this approach is “liking” is a very relative term. Two members can have very different standards for evaluating things. Rating standards can change day to day, or even by the time of day. There are many factors that can affect a member’s rating standard including demographic profile, culture, and location; the list is nearly endless. This approach is not very robust. However, this can perform satisfactorily if you have a sufficiently large data set.</p><p><strong>Content-based collaborative filtering: </strong>The concept is similar to the user-based filtering, only instead of making a similarity score between members, we create a similarity score between our different products. If Products A and B have very similar scores based on their type, (protein bars, chips, or fruit snacks, etc) and a member likes Product A, then the engine would recommend Product B to the same user based on content similarity. This approach is more robust and efficient in our case. Personally, I find a content-based model more robust and efficient than user-based systems because similarities between the two products are going to be more consistent. Users may change, but a protein bar will always be a protein bar.</p><p>Personally, I am more attracted to the<a href="https://en.wikipedia.org/wiki/Item-item_collaborative_filtering"><strong> Item-based collaborative </strong></a>approach over <a href="http://ijcsit.com/docs/Volume%202/vol2issue3/ijcsit2011020363.pdf"><strong>User-based collaborative methods</strong></a> to build a recommendation system. There are many other approaches to build a recommendation system like modern model-based methods, matrix factorization methods and deep-learning methods which I plan to explore in the future. In addition to these approaches, I can also try something similar to very recent techniques like <a href="https://www.researchgate.net/publication/302992329_Recommending_Movies_Based_on_Mise-en-Scene_Design">Mise en sense</a> method which was invented for movie recommendation or <a href="http://cseweb.ucsd.edu/~jmcauley/pdfs/ijcai18.pdf">Translation based recommendation</a> for further improvement. Although at this moment, I think, any classical approach can produce great results for our current business needs.</p><p>We are working to enter our members’ minds and hearts to curate the perfect snack box with the right selection of sweet, savory and crunchy snacks to make an amazing break room experience for their workplaces. This starts by identifying and recommending products based on our members’ personal preferences. We want members to have what they need at any time, whether it’s crunchy stuff with high protein in the morning and fruity snacks with their afternoon tea. To collect more micro-level structured data, we are building our own SnackNation App with a member employee mobile experience, which will allow employees at our members to directly tell us what they like, starting in early 2020.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEn3CGybkhNPZYNjcXDIyw.jpeg" /><figcaption>SnackNation’s snack recommendation engine</figcaption></figure><p>We are experimenting with lots of different approaches, including hybrid approaches, to make a robust recommendation system that would truly understand our members’ preferences so that when they enter the breakroom at their workplace they will find exactly what they are craving.</p><p>Thank you for reading. I want to thank my team@SnackNation for the support and <a href="https://sundog-education.com/">Mr. Frank Kane</a> for teaching me how to think to build an effective recommendation system. A special shoutout goes to <a href="https://medium.com/@jasonmdeal">Jason Deal</a> for carefully proofreading the article and <a href="https://medium.com/@shannon.duke">Shannon Duke</a> for creating special graphics that complement the writeup.</p><p><em>Please share your thoughts and constructive suggestions for any possible improvements in the comments below. Also, stay tuned for many more exciting Machine Learning projects coming up at SnackNation.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a89bfa222191" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snacknation-engineering/how-snacknation-is-engaging-machine-learning-to-recommend-the-perfect-snack-that-you-are-craving-a89bfa222191">How SnackNation is engaging Machine Learning to recommend the perfect snack that you are craving…</a> was originally published in <a href="https://medium.com/snacknation-engineering">SnackNation Engineering &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How SnackNation Evaluates Performance Metrics for Machine Learning Algorithms]]></title>
            <link>https://medium.com/snacknation-engineering/how-snacknation-evaluation-metrics-for-machine-learning-algorithms-with-python-code-3dd8a1fc94fc?source=rss-94916ab27d47------2</link>
            <guid isPermaLink="false">https://medium.com/p/3dd8a1fc94fc</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[lead-generation]]></category>
            <dc:creator><![CDATA[Kanad Basu, PhD]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 20:55:45 GMT</pubDate>
            <atom:updated>2019-07-02T20:35:20.893Z</atom:updated>
            <content:encoded><![CDATA[<h3>How SnackNation Evaluates Performance Metrics for Machine Learning Algorithms: A Real Life Example in Python</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiGGUzIJZVw9aal1ClLXSw.jpeg" /><figcaption>Data Science@SnackNation</figcaption></figure><p>At <a href="https://www.snacknation.com/">SnackNation</a>, we believe snacks are not just snacks, but are integral part of living a happier, healthier, more purposeful life. SnackNation’s mission is to find emerging, health conscious snack brands and connect them around the snack bowl to like-minded people.</p><p>As members of the Business Intelligence team, we are responsible for developing and overseeing the execution of the company’s data-driven strategies by leveraging technology, artificial intelligence, and real-time data to facilitate best in class consumer insights and deliver premium products to consumers nationwide. <a href="https://medium.com/snacknation-engineering/snack-stats-conducting-eda-hypothesis-testing-to-uncover-how-health-and-wellness-consumers-snack-df1016ae4ba5">For example, through statistical testing of our product feedback data, we are able to provide insights to our brand partners of what our customers liked and didn’t like about their products and what demographic categories these customers fell into.</a></p><p>In the past, we have developed a churn prediction model for our customer service team to <a href="https://medium.com/snacknation-engineering/how-snacknation-leverages-machine-learning-to-predict-and-prevent-customer-churn-e4be39036e24">identify customers with the highest risk of churn</a>. Likewise, we are building another machine learning model for our Marketing team to target better leads. This model will be able to predict if a lead has a higher probability of being converted to a paid customer and will help the leaders of the marketing team allocate the appropriate leads to the right sales representative. The success of the project will be calculated by tracking the revenue generated for each targeted lead.</p><p>Since this problem has been solved multiple times across the industry, we will NOT focus on the modeling aspects. Rather, this post will explain various machine learning evaluation metrics in context of the leads predictor problem mentioned above. We plan to explain the advantages of choosing certain matrices over others in context of our problem with examples.</p><h3>Metrics</h3><p>After creating a predictive model from our labeled data set, we know that every prediction our model makes falls into one of these four categories:</p><ul><li><strong>True positive (TP): </strong>The targeted lead converted to paid customer and the model also correctly predicted that the lead will convert <strong>(correct classification).</strong></li><li><strong>True negative (TN):</strong> The targeted lead did not convert to paid customer and the model also predicted that the lead would not convert <strong>(correct classification).</strong></li><li><strong>False positive (FP) or Type-I Error:</strong> The lead did not convert, but the model incorrectly predicted the lead would convert to paid customer <strong>(incorrect classification).</strong></li><li><strong>False negative (FN) or Type-II Error: </strong>The targeted lead converted to paid customer, but the model incorrectly predicted that the lead would not convert <strong>(incorrect classification).</strong></li></ul><p>These categories can also be represented in a confusion matrix depicted in Table 1 that allows us to visualize the performance of a supervised machine learning algorithm with binary target. A perfect predictive model would have only true positives and true negatives, so its confusion matrix would only have nonzero values on its main diagonal and non diagonal would be zeros. While a confusion matrix provides valuable information about a model’s performance, it is often preferable to have a single metric to easily compare the performance of multiple classifiers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*yAbd8F9cny2EWIvRKSoU3Q.png" /></figure><p>Now that we know the definitions, let’s put things into context. For our leads predictor, we care more about the Type — II error. If we fail to recognize a potential lead and mis-classify it as a ‘No Conversion’ lead, it will lead to lost potential revenue. Instead, if we allow a bad lead to pass through to the representatives (Type — I error), it will cost us time and wasted effort, which is not favorable. The business then has to decide which case is more favourable. In our case, we want to focus on minimizing Type-II error.</p><p><strong>Accuracy</strong></p><p>Accuracy measures how often the classifier makes the correct prediction. In other words, it is the ratio of the number of correct predictions to the total number of predictions. Accuracy is defined as the fraction of correct predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*MCn5qowg9n8dwgKcnaXubQ.png" /></figure><p><strong><em>Putting Accuracy into context</em></strong><br>Accuracy is usually the first measure used to determine whether a machine learning algorithm is making enough correct predictions or not. Using accuracy as a metric to evaluate the performance of a classifier can often be misleading, especially in the presence of class imbalance. Class imbalance refers to the classic case when one binary target class is lot larger than the other class. Simply using the accuracy score could result in a false impression regarding the model performance when class imbalance is present in our dataset. In our case, class imbalance is present as the number of leads that actually convert is a small percentage of total leads targeted.</p><p>For example, in our training data set the leads that converted to a sale is only 12% in compared to the leads which didn’t convert (88%). Then our model can easily get 88<strong>% training accuracy</strong> by simply predicting that every training sample belongs to non-convergent lead. When the same model is tested on a test set with 64% samples of class A and 36% samples of class B, then the <strong>test accuracy would drop down to 64%. </strong>Classification Accuracy is great, but gives us the false sense of achieving high accuracy.</p><p>Instead, we use the more suitable metrics of precision, recall, <strong>Fᵦ </strong>score and area under the precision recall curve to overcome the challenges caused by this class imbalance phenomenon. Below we provide the definition of the standard performance evaluation metrics of precision and, recall and also discuss the more appropriate measures of performance when class imbalance is present.</p><p><strong>Precision</strong></p><p><strong>Precision</strong> measures how accurate our positive predictions were. In other words, it tells us what proportion of points predicted were true positives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/379/1*4k6GiCmWoYgyCJTKuiM2wg.png" /></figure><p><strong>Recall or True-Positive Rate</strong></p><p><strong>Recall</strong> measures what fraction of the positive predictions our model identified, were correctly predicted as positive. Another way to phrase this is that Recall is the fraction of positive predictions the model is able to catch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*H6HQ45cF3jQbuA9PSb6mVg.png" /></figure><p><strong>False-Positive Rate</strong></p><p>The <strong>False-Positive Rate</strong> is the ratio of negative instances that are incorrectly classified as positive, i.e.,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*dnrF_BejsaUMllRs-Z5Spw.png" /></figure><p><strong><em>Putting Precision and Recall in Context</em></strong></p><p>Let us explain the concept with a concrete example presented below in form of the Table 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*4wbmlPhfTUrqOsUhJ03kvA.png" /></figure><p>In our case, precision represents the percentage of predicted positive leads that were actually converted to a sale. Recall, in a similar context, represents how many potential positive leads of all the positive leads were predicted positive by our model. Let us look at a hypothetical case where we had a population of size 100 leads. Let’s say out of these 100, 80 leads actually converted to a sale and 20 leads did not.</p><p>Our hypothetical model recognized only 30 out of the 80 conversions and the rest of the 50 were tagged as ‘No conversion’. Another output was that out of the 20 ‘No conversions’, 15 were recognized correctly whereas the remaining 5 leads were tagged incorrectly as ‘Conversion’. From the table our accuracy is (30+15)/(30+50+5+15)=45/100= 45.00%, and our precision is 30/(30+5)=30/35= 85.71% whereas our recall score is 30/(30+50)=30/80= 37.5%.</p><p>From this example, we see that even if Precision is high, our recall is low. Since we care more about the minimizing Type-II error over Type-I error, we need our model to have a high Recall score.<br> <br>Clearly our hypothetical model is not serving our goal having a low recall value. In this situation, we need to tune our model so that it will perform well with recall and moderate with precision. It is very inconvenient to take care of two different metrics while evaluating our model performance hence we introduce a new metric <strong>Fᵦ</strong> score which is a weighted combination of precision and recall. The value of β can be chosen according to the problem needs and priorities (explained below).</p><p><strong>F₁ Score</strong><br>The <strong>F₁ Score </strong>is the harmonic mean of precision and recall and thus must lie between them. The F₁ score<strong> </strong>is closer in value to the smaller of precision and recall. As a result, if one of the precision or recall values is low the F₁ score is also low. It is notable that F₁ score gives equal weights to precision and recall, but for our problem this is not very useful as we would like to favor recall in our model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*4QISq8uKdlGa6XILvhla7Q.png" /></figure><p><strong>Fᵦ Score</strong><br>The <strong>Fᵦ Score</strong> is the weighted harmonic mean of precision and recall, reaching its optimal value at 1 and its worst value at 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*7nXjnlx5GxVjT6GCnpwpSg.png" /></figure><p>The β parameter determines the weight of precision in the combined score, i.e, β &lt;1 lends more weight to precision, and β&gt;1 favors recall. When β=1 the resulting F₁ score is the harmonic mean of precision and recall and thus must lie between them.<br>Further, β=0 considers only precision and β → ∞ considers only recall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*xj0wKHn9fFYVb4H8LCrw0g.png" /></figure><p>As our problem is more Recall heavy we want a β value that would put more weight on recall and less weight on precision. Putting heavier weight on recall means we don’t want our model to miss any potential leads and predict those as potential convergent lead. At the same time, going easy on precision means the sales team will spend more of their effort and time on a false positive prediction. For this case, we need a balancing act to take care of both recall and precision with proper weight that is suitable for our business need. Finding the right β is not an exact science but rather requires lots of experimentation and domain knowledge of the data. For our problem we have decided to go with β = 2.</p><p><strong>ROC</strong><br>The receiver operating characteristic (ROC) curve is another commonly used summary for assessing the diagnostic ability of a binary classifier over all possible results as its class discrimination threshold is varied. Class discrimination is most often set to be 0.5. The ROC curve is a plot of the true-positive rate (also known as sensitivity or recall) versus the false-positive rate.</p><p><strong>PR Curve</strong><br>The PR curve is the precision recall curve with precision as x axis and recall as y axis. PR curve is generally a better indicator of model quality when dealing with class imbalance. In order to compare we calculate the AUC for the PR curve instead of the ROC curve. <br>Since our problem has class imbalance, we chose to visualize our model performance using PR curve</p><p><strong>AUC Score</strong><br>The AUC score is defined as the area under the ROC or PR curve. <br>The AUC score measures the overall performance of a classifier without having to take into consideration the class distribution or mis-classification cost. The closer the AUC score is to 1 (the maximum possible value), the better the overall performance of the binary classifier.</p><h3><strong>Coding Example in Python</strong></h3><p>Here we explain all the measurement tools discussed above with a simplified yet practical data set related to <a href="https://www.snacknation.com/">SnackNation</a> marketing problem using small code recipes. Here all the code is written in <a href="https://www.python.org/">Python</a> with the help of python based library <a href="https://scikit-learn.org/stable/">sklearn</a>. Due to the confidentiality of our data, for the purpose of this post, we’ve created a mock data set saved as pandas dataframe object named as ‘df’ . For simplicity, we are assuming the dataset is all cleaned and ready to work on. Moreover, as our data suffers from a class imbalance problem, it is very important to work on some feature engineering aspects before proceeding to the modeling part.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WDgIV0P1nMcIL5mzvmCp6A.png" /><figcaption>Predictive Model Builder Workflow</figcaption></figure><p>Photo Credit: <a href="https://untitled-research.com/blog/the-case-for-predictive-lead-scoring-in-recruitment">Untitled-Research</a></p><p>Let’s start with looking at the dataset real quick:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ba6dea921eb12d047f38a02d7d22520/href">https://medium.com/media/0ba6dea921eb12d047f38a02d7d22520/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uSjyxXNth4hWPr9-pKGGZQ.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c03caea533377bb1e4c635c7ef3474b/href">https://medium.com/media/3c03caea533377bb1e4c635c7ef3474b/href</a></iframe><p>After converting the target variable into binary output, let’s have a quick look at the variables we are going to deal with.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c47407ad1dee28940fc5b2fa8077239/href">https://medium.com/media/7c47407ad1dee28940fc5b2fa8077239/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4xiY5dNRNOAYxS5-7At11g.png" /></figure><p>As all of our variables are categorical variables, we treat those with one-hot-encoding for modeling purposes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54dbcae7ce19347797335b72318f82ab/href">https://medium.com/media/54dbcae7ce19347797335b72318f82ab/href</a></iframe><p>After exercising some preprocessing the dataset now looks like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y4B2j5jTMpBDW6prVS5eIg.png" /></figure><p>In the next code snippet, we separate the label and features of the data for evaluation.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/405564448b2c19c74c878acfa3a9f8b0/href">https://medium.com/media/405564448b2c19c74c878acfa3a9f8b0/href</a></iframe><p>Now we split our data set into train test split where we reserve 80% data for training and 20% data for testing purposes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b979e358ae7e9dc4dfb04c57373ab77/href">https://medium.com/media/5b979e358ae7e9dc4dfb04c57373ab77/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*AJ-6IRhmKq6skGM5lZoQEg.png" /></figure><p>For illustration purposes, we choose a random forest classifier (our favorite!!!) on our dataset although one can try out with any other classification for best result. Below is a code to evaluate the performance of random forest on the basis of different evaluation metrics and create a data frame to display the result.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e629475fd488296bffccbd75b00c20c4/href">https://medium.com/media/e629475fd488296bffccbd75b00c20c4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wgDYpFk72QEWirY4KY8sQ.png" /></figure><p>Now we present a convenience report feature provided by scikit-learn when working on classification problems to give us a quick idea of the accuracy of a model using a number of measures.</p><p>The <em>classification_report()</em> function displays the precision, recall, f1-score and support for each class. The code example below demonstrates the report on our classification problem.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea2d193f21257510a5160cd1e7eb2af9/href">https://medium.com/media/ea2d193f21257510a5160cd1e7eb2af9/href</a></iframe><p>Finally, The next two code pieces show the calculation of a confusion matrix and a Fᵦ score with β = 2.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33b54300084a157e7c0b8ce4c0050eed/href">https://medium.com/media/33b54300084a157e7c0b8ce4c0050eed/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d7bb9524a192bea8d1d9a134f4c28a0/href">https://medium.com/media/0d7bb9524a192bea8d1d9a134f4c28a0/href</a></iframe><h3>Conclusion</h3><p>Albert Einstein once said, “if you judge a fish on its ability to climb a tree, it will live its whole life believing that it is stupid.” This quote really highlights the importance of choosing the right evaluation metric in the right situation. At SnackNation, our Business Intelligence team makes sure that we choose our evaluation metrics based on the problem context and data. As we continue to grow, we plan to automate the metric selection process to evaluate our prediction models so that we can scale the problem better.</p><p>My sincere appreciation goes to the entire SnackNation team specially to my co-contributor <a href="https://medium.com/u/3e890bc86335">Aman Mathur</a> and each member of the BI team for their tremendous support at the time of writing this article. Special shout out goes to our captain <a href="https://medium.com/u/fe433b39252e">Aihui Ong</a> for her constant encouragement to engage in writing this article. Last but not the least, thank you Shannon Duke, our Sr. Graphic Designer at SN for designing cool graphics for this post.</p><p><em>Thank you for reading.</em> <em>Please share your thoughts and constructive suggestions for any possible improvements in the comments below. Also, stay tuned for many more exciting Machine Learning projects coming up at SnackNation.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3dd8a1fc94fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/snacknation-engineering/how-snacknation-evaluation-metrics-for-machine-learning-algorithms-with-python-code-3dd8a1fc94fc">How SnackNation Evaluates Performance Metrics for Machine Learning Algorithms</a> was originally published in <a href="https://medium.com/snacknation-engineering">SnackNation Engineering &amp; Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>