<?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 Mohit Joshi on Medium]]></title>
        <description><![CDATA[Stories by Mohit Joshi on Medium]]></description>
        <link>https://medium.com/@mohitjoshi51196?source=rss-b0811ffca2be------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Mohit Joshi on Medium</title>
            <link>https://medium.com/@mohitjoshi51196?source=rss-b0811ffca2be------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 18:51:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mohitjoshi51196/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[Natural Language Processing on Disaster Tweets]]></title>
            <link>https://medium.com/@mohitjoshi51196/natural-language-processing-on-disaster-tweets-35762103a144?source=rss-b0811ffca2be------2</link>
            <guid isPermaLink="false">https://medium.com/p/35762103a144</guid>
            <category><![CDATA[disaster-tweets]]></category>
            <category><![CDATA[bert-text-classification]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[bert-base]]></category>
            <dc:creator><![CDATA[Mohit Joshi]]></dc:creator>
            <pubDate>Sat, 06 Aug 2022 06:40:53 GMT</pubDate>
            <atom:updated>2022-08-06T06:44:54.641Z</atom:updated>
            <content:encoded><![CDATA[<p>Deep Learning Text Classification</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4grKFsVk3c1IuYnTLzZBQ.jpeg" /><figcaption>Source- Google</figcaption></figure><p>This article includes:-</p><ol><li>Data Overview</li><li>Data Description</li><li>Business Problem</li><li>ML Formulation</li><li>Performance Metric</li><li>Exploratory Data Analysis</li><li>Preprocessing</li><li>Modeling</li><li>Conclusion</li><li>Deployment</li><li>Links</li><li>References</li></ol><h4>1) Data Overview</h4><p>Twitter has become an important communication channel in our lives. We know that news travel fast, but on Twitter, it travels faster. We get most of the News from Twitter these days whether they are related to the politics of a country or some emergency in another. The ubiquitousness of smartphones enables people to announce an emergency they’re observing in real-time. Because of this, more agencies are interested in programmatically monitoring Twitter (i.e. disaster relief organizations and news agencies). But, it’s not always clear whether a person’s words are announcing a disaster.</p><p>This is a Kaggle competition where it is required to make a model that predicts whether Tweets are about real disasters or not. We’ll have access to a dataset of 10,000 Tweets that were hand classified.<br>Dataset can be downloaded from here:- <a href="https://www.kaggle.com/competitions/nlp-getting-started/data">https://www.kaggle.com/competitions/nlp-getting-started/data</a></p><h4>2) Data Description</h4><p>The dataset consists of train and test data. Train data has 5 columns:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MjLEpIR1dv2mGNp1RCNelQ.png" /><figcaption>Top 5 rows of train data</figcaption></figure><p>text- text of the Tweet</p><p>keyword- a keyword from the Tweet (may be blank)</p><p>location- location from where Tweet was posted(may be blank)</p><p>target- 1 means it is related to a disaster, 0 means not related to a disaster</p><h4>3) Business Problem</h4><p>Our objective is to make a model that can filter out Tweets that are related to Real Disasters with the highest accuracy. This model, then, can be used in real-time when the disaster is happening and services like food, shelter, and medical care can be provided to the right people in minimal time.</p><h4>4) ML Formulation</h4><p>This is a text classification task. We are required to classify Tweets as 1 or 0 where 1 would mean the Tweet is related to a Real Disaster and 0 would mean Not related to a Real Disaster. Our objective here is to classify the Tweets related to a Real Disaster with maximum accuracy.</p><h4>5) Performance Metric</h4><p>Here, the cost of misclassification of disaster-related tweets is more than non-disaster-related tweets. This means we need to minimize the wrong prediction of disaster-related tweets i.e. we need to minimize FN(False Negatives).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lCIlL14QV8Cbc-boLgGN-g.png" /><figcaption>Distribution of Labels</figcaption></figure><p>From the above graph, we can see data is slightly imbalanced. Since we need to minimize FN, our metrics would be Recall and F1 Score. We need higher Recall i.e. out of all the actual positives, how many are predicted positives?</p><p>Note:- Model is predicting 1(positive) when Tweet is related to a Real Disaster.</p><h4>6) Exploratory Data Analysis</h4><p>It can be seen from above (rows of train data) that there are null values present in the keyword and location column. In our case, we will not require location and since we are using Deep Learning Text-based techniques, we don’t require keyword column as well. So I removed these two columns.</p><p>Tweets, that are related to disasters, have certain words in them which are repeatedly used and can act as identifiers. To check this, I made a Word cloud of both types of Tweets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*tPpLZdRoPo-gtEZUtZ--fg.png" /><figcaption>Word Cloud of Non-disaster Tweets</figcaption></figure><p>In non-disaster Tweets, the more frequent words are ‘amp’, ‘one’, ‘time’ etc. We can also spot ‘good’, ‘love’, ‘laughing’. All of these words are positive or neutral words.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*uOPuzmzwSB_MAzx4pKIYeQ.png" /><figcaption>Word Cloud of Disaster Tweets</figcaption></figure><p>In Disaster Tweets, the words like ‘fire’, ‘storm’, ‘death’, and ‘flood’ dominate. All of these words are negative and indicate a mishappening.</p><p>After this, I checked whether both types of Tweets can be separated by their lengths. I plotted Histograms of the lengths of both types of Tweets. As we can see the distributions are somewhat similar. Both distributions are left-skewed. Lengths of Disaster Tweets are mainly concentrated above 85. In the case of Non-disaster Tweets, Tweets have lengths of different types distributed almost equally.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UsO1qcv0IN6un6JFYABGQ.png" /></figure><p>Then I plotted Histograms of the number of words in a Tweet for both types. The distribution here is more similar, most of the Tweets are concentrated in the number of words ranging from 10 to 20.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhWJOYRB5tj7MjWT5u3BKA.png" /></figure><p>The last step in EDA, was to check if the Tweets can be separated by the average word lengths. There is a presence of outliers in the distribution, the distributions are following almost Gaussian curves.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uQ0_yQt6fS2uCIWRxWr2SA.png" /></figure><h4>7) Preprocessing</h4><p>Since we are using State of Art Deep Learning models, we did only basic preprocessing of Tweets. Basic preprocessing includes lowercasing , decontracting the text, removing HTML and URLs, and converting slang to its real form. Tweets have slangs in them which can be difficult for the model to understand.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/56a2a0e19d164fc325c15950a3445456/href">https://medium.com/media/56a2a0e19d164fc325c15950a3445456/href</a></iframe><h4>8) Modeling</h4><p>I used 3 BERT models — RoBERTa, DistilBERT and BERT-Base.</p><ol><li><strong>RoBERTa</strong></li></ol><p>RoBERTa has the same architecture as BERT, but uses a byte-level BPE as a tokenizer (same as GPT-2) and uses a different pretraining scheme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkvIzJPEnTRBB1WXm0MaXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*r8JihUBNGXx_g1C8DZibQA.png" /><figcaption>AUC-ROC Curve and Confusion Matrix of RoBERTa results</figcaption></figure><p>As we can see the total misclassification percentage is more than 35% . It performed poorly on both the labels with very low F1-Score. False Negative percentage is about 17% which is not satisfactory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*06d-wGVvH1Junk5dTkgq6w.png" /><figcaption>Different Metrics for RoBERTa</figcaption></figure><p><strong>2. DistilBERT</strong></p><p>DistilBERT is a small, fast, cheap and light Transformer model based on the BERT architecture. Knowledge distillation is performed during the pre-training phase to reduce the size of a BERT model by 40%. The idea here is that once a large neural network has been trained, its full output distributions can be approximated using a smaller network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AH0tal8ylzf8KaCPfUq7dQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*Y71ihWL3VLRbHqSvktXSmw.png" /><figcaption>AUC-ROC Curve and Confusion Matrix of DistilBERT results</figcaption></figure><p>We can see that DistilBERT performed way better than RoBERTa with total misclassification of about 19% and False Negatives percentage less than 10%. F1 Score and Recall also improved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*Eq-CTuxUyUQdgism9wLc4Q.png" /><figcaption>Different Metrics for DistilBERT</figcaption></figure><p><strong>3. BERT-Base</strong></p><p>This is a smaller version of BERT, which has 12 encoder layers stacked on each other with 768 hidden sizes, 12 self-attention heads and total 110Million parameters to train.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mApVhy5szL_SEvc-r-Kh4g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*MZVU-ou-nzxeNnj5ldqulg.png" /><figcaption>AUC-ROC Curve and Confusion Matrix of BERT-Base results</figcaption></figure><p>As you can see from the ROC curve, the model performed pretty well, total misclassification is less than 17%, FN percentage is less than 10%. We needed to minimize FN. F1 score is pretty good with highest Recall among all the three models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*4M97HfEnJLvvMZUSqGPCCQ.png" /><figcaption>Different Metrics for Bert-Base</figcaption></figure><h4>9) Conclusion</h4><p>We trained data with 3 types of BERT models and got best results with BERT-Base as it gave the highest Recall along with highest F1 Score. So, it will be our final model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c56d10ef0169826b8042d394ed13bf60/href">https://medium.com/media/c56d10ef0169826b8042d394ed13bf60/href</a></iframe><h4>10) Deployment</h4><p>I made a Streamlit web app using BERT Base model that can predict whether Tweet is about Real Disaster or not. Here is the deployment video of the app, the code can be found in the links section.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F737066578%3Fh%3D62a2cb011c%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F737066578&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1483056249-4947e1290483fcdbffa5948abc4a8b04d1a17723552302b2854a26564498c6b7-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e428319ba089db01f6a082e64a6ed54/href">https://medium.com/media/0e428319ba089db01f6a082e64a6ed54/href</a></iframe><h4>11) Links</h4><ul><li>Code link — <a href="https://github.com/MoJo005/NLP-on-Disaster-Tweets">https://github.com/MoJo005/NLP-on-Disaster-Tweets</a></li><li>Likedin — <a href="http://www.linkedin.com/in/mojo005">www.linkedin.com/in/mojo005</a></li></ul><h4>12) References</h4><ul><li>Course- <a href="https://www.appliedaicourse.com/">https://www.appliedaicourse.com/</a></li><li>Research paper 1- <a href="https://aclanthology.org/W16-6201.pdf">https://aclanthology.org/W16-6201.pdf</a></li><li>Research paper 2- <a href="https://ojs.aaai.org/index.php/ICWSM/article/view/14119">https://ojs.aaai.org/index.php/ICWSM/article/view/14119</a></li><li>blog 1-<a href="https://jalammar.github.io/illustrated-transformer/">https://jalammar.github.io/illustrated-transformer/</a></li><li>blog 2-<a href="https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/">https://jalammar.github.io/visualizing-neural-machine-translation-mechanics-of-seq2seq-models-with-attention/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35762103a144" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customer Satisfaction Prediction on Olist Brazilian Dataset]]></title>
            <link>https://medium.com/@mohitjoshi51196/customer-satisfaction-prediction-on-olist-brazilian-dataset-63f5e408fa9e?source=rss-b0811ffca2be------2</link>
            <guid isPermaLink="false">https://medium.com/p/63f5e408fa9e</guid>
            <dc:creator><![CDATA[Mohit Joshi]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 16:49:00 GMT</pubDate>
            <atom:updated>2022-08-02T05:17:17.024Z</atom:updated>
            <content:encoded><![CDATA[<p>Machine Learning Classification Problem</p><figure><img alt="Olist (Brazilian E-commerce Store)" src="https://cdn-images-1.medium.com/max/1024/1*1k72mg1_CZvLptX77zzKTg.png" /><figcaption>Olist (Brazilian E-commerce Store)</figcaption></figure><h3>This article includes:</h3><ol><li>Data Overview</li><li>Data Description</li><li>Business Problem</li><li>ML Formulation</li><li>Performance Metric</li><li>Exploratory Data Analysis</li><li>Preprocessing</li><li>Feature Engineering</li><li>Modeling</li><li>Conclusion</li><li>Deployment</li><li>Future Work</li><li>Links</li><li>References</li></ol><h3>1) Data Overview</h3><p>This is a Brazilian public dataset of orders made at Olist Store which is the largest department store in Brazilian marketplaces. It connects small businesses from all over Brazil and ships their products to the customers using Olist logistics partners.<br>After a customer purchases the product from Olist Store, a seller gets notified to fulfill that order. Once the customer receives the product, or the estimated delivery date is due, the customer gets a satisfaction survey by email where he can give a note for the purchase experience and write down some comments.</p><p>This dataset is available at Kaggle and can be downloaded from: <a href="https://www.kaggle.com/datasets/olistbr/brazilian-ecommerce?select=olist_orders_dataset.csv&amp;page=3">https://www.kaggle.com/datasets/olistbr/brazilian-ecommerce?select=olist_orders_dataset.csv&amp;page=3</a></p><h3><strong><em>2) Data Description</em></strong></h3><p>The dataset has information from 100k orders from 2016 to 2018 made at multiple marketplaces in Brazil. This dataset has 9 tables :</p><p>1)Orders Dataset<br>2) Order items dataset<br>3) Order payments dataset<br>4) Order reviews dataset<br>5) Customers dataset<br>6) Sellers dataset<br>7) Products dataset<br>8) Geo-location dataset<br>9) Product category name translation English — This table consists of the English translation of the products from Portuguese.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNvwg8E0ZGkvaITs-LYryA.png" /><figcaption>Olist Database Schema</figcaption></figure><p>This is a dataset that can help understand customer behavior, help optimize the logistics and improve the quality of products. There are multiple dimensions to this dataset. We will be focusing on predicting customer satisfaction.</p><h3>3) Business Problem</h3><p>Our goal is to predict whether a customer will give a positive review or a negative review for a product before he/she gives a written text review. If the polarity of the reviews can be predicted and then the underlying problem can be solved then it would be better for the business to have satisfactory customers.</p><h3>4)ML Formulation</h3><p>We are given a 5-star rating system, we will be classifying the ratings in a binary classification, we will be converting all the ratings more or equal to 4 into 0(Positive rating) and ratings less than 4 into 1(Negative Rating). Our objective here is to minimize the negative ratings.</p><h3>5) Performance Metric</h3><p>Our goal is to make a model that will predict negative reviews correctly with highest accuracy. That means the cost of misclassification of negative reviews is higher than that of positive reviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XgisEwqXGiLH3Z9qZY0Zvg.png" /><figcaption>Distribution of Reviews</figcaption></figure><p>Since data is highly imbalanced with negative reviews as a minor class so when the model predicts review as negative we would classify it as 1 and when the model predicts review as positive we would classify it as 0</p><p>We would need to minimize the number of False Negatives while keeping the accuracy maximum, so we would use the F1 score with high recall i.e out of all the actual positives, how many are predicted positive.</p><p>Note- Prediction=1 would mean that the review is negative.</p><h3>6) Exploratory Data Analysis</h3><p>There are a total of 9 tables containing primary and foreign keys. We need to merge all the tables based on the primary and foreign keys so that we get a single data frame.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb02d4d45b5efff54e756dce8083a671/href">https://medium.com/media/bb02d4d45b5efff54e756dce8083a671/href</a></iframe><p>We need to remove all the null and duplicated values before we proceed with EDA.</p><p>In any business, most valuable are the customers. A business must know all the relevant details about its customer base.</p><p>From the graph, it is clear that most of the orders are received from states Sao Paulo, Rio de Janeiro, and Minas Gerais which means more than 50% of the customers live in these area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*W-9lHjKXz8iy2rnXRtBAUA.png" /></figure><p>Most of the sellers also live in the same states, it is good for the business as the logistics cost and delivery time can be reduced if the sellers of the same states can fulfill the demands of the customers living in the same states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Md94rAKspYfd8Wi-jI-Fvg.png" /></figure><p>More than 50% of the customers use a credit card for purchasing on Olist. Credit card and Boleto consist of more than 96% in payment types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*G0XXv55rfPmOmEtGESfIBA.png" /></figure><p>The dataset consists of <strong>order_purchase_timestamp</strong> ,<strong>order_approved_at</strong> ,<strong>order_delivered_customer_date</strong> ,<strong>order_estimated_delivery_date</strong></p><p>I extracted the month wise data and plotted total number of orders in each month. From the graph it is clear that most number of orders were placed in the month of November 2017 and January 2018. The reason could be because of the various festivals in November and December.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SkOiSmv84w-KPSwnvCdjpg.png" /></figure><p>I also plotted month-wise sales data which is showing the total revenue generated in each month. Most number of orders were placed in the month of November 2017 and it also generated the maximum revenue , followed by April and May of 2018</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0LG8eF6hjMJq36-y8HNgiA.png" /></figure><p>Let us now focus on the product’s categories, bed_bath_table and health_beauty are the two top categories from which maximum products were sold followed by sports _leisure and furniture_decor</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t0qjSmaDpMTUKeMTvAr2cg.png" /></figure><p>Though maximum revenue was generated by health_beauty and watches_gifts followed by bed_bath_table and sports_leisure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRJrH7gzoTDZj1_JbKMamw.png" /></figure><p>We are trying to predict reviews, so it is necessary to understand which product_category is being reviewed negatively the most. The most bad reviews given by customers, percentage wise, is diapers_and _hygiene followed by security_and_services. From the below graph it is clear that more than 50% customers that purchased items from both of these categories are not satisfied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tLCd-QogsLoatQ4_qFyibg.png" /></figure><p>Let us focus on the product details now. In the dataframe we are provided with length of product’s name and length of its description. Anytime a customer purchases a product he/she reads the name and its description, the more clear and the more detailed the description, it is better for customers to understand about the product. I have made a box plot of the same and it can be seen that we have heavy number of outliers in the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDFcEisxphejMY6J-BEDVQ.png" /></figure><p>This outlier problem also persists in Price and Freight Values as we can see from the below plot. The variations in the prices are huge. We would have to handle this outlier problem</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*-Mk1VeBsTXtp2aNnVnQoXA.png" /></figure><p>Finally, I extracted all the necessary features from the dataframe that are required for us to predict customer satisfaction and removed the useless features. I removed customer reviews for two reasons: more than 60% data is not present in reviews and we are required to predict whether the customer would give a positive or negative review before he/she gives any review, so we don’t need to parse reviews.</p><p>I found the correlation between final selected features. Price and payment value have high correlation, so we will only be using price and not payment value as it would lead to the problem of collinearity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BYjD3mYX83P_wv7AoLO98Q.png" /><figcaption>Correlation Matrix</figcaption></figure><h3>7) Preprocessing</h3><p>To handle the outliers we capped them at 5 and 95 percentile. It means all the values below 5 percentiles are converted to value equal to 5 percentile and all the values more than 95 percentile are converted to value equal to 95 percentile. This is called Percentile Capping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49475ead440aac05a2fc4665a6720c47/href">https://medium.com/media/49475ead440aac05a2fc4665a6720c47/href</a></iframe><h3>8) Feature Engineering</h3><p>In e-commerce, it is of utmost importance to deliver the products as quickly as possible and within the estimated delivery time. The products must be delivered at or before the timeframe company has shown to the customers, otherwise customers can get really disappointed by the service.</p><p>The reviews of products also depend on the sellers. Some sellers sell better quality products than others and so the probability of their products getting a negative review is very less.</p><p>Based on the above ideas I designed 5 features :-</p><p>estimated_delivery_days — estimated days for the delivery of a product</p><p>actual_delivery_day — actual number of days taken for the delivery of a product</p><p>delivery_accuracy — this is the difference between estimated_delivery_days and actual_delivery_days, which tells how early or late a product is delivered</p><p>late_delivery — this is a binary feature, 1 is for late delivery and 0 is for early or on time delivery</p><p>seller_popularity — this feature consists of total number of products, a seller has sold, more products sold by a particular seller means he/she is more popular</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d1cfa6aae5c197344130ee18a65c445/href">https://medium.com/media/8d1cfa6aae5c197344130ee18a65c445/href</a></iframe><p>Since the data is highly imbalanced, class_weights were used to penalise the majority class.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6db379fdf766a1a2d939f6a828bd304e/href">https://medium.com/media/6db379fdf766a1a2d939f6a828bd304e/href</a></iframe><h3>9) Modelling</h3><p>We used 4 machine learning algorithms for classification:-</p><h4>1. Logistic Progression</h4><p>In logistic regression, C is the parameter that we need to tune to control the penalty strength.</p><pre>{&#39;C&#39;: 0.1}</pre><p>More than 30% of the points are being misclassified. 10% of the points are False Negatives. We need to minimize this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ty7NtqrvGtsZ6qS5g5hiTQ.png" /><figcaption>Logistic Regression Results</figcaption></figure><h4>2. Decision Trees</h4><p>In decision tree, 3 parameters were hyper tuned.</p><pre>{&#39;max_depth&#39;: 30, &#39;max_leaf_nodes&#39;: 700, &#39;min_samples_split&#39;: 5}</pre><p>We can see that the misclassification is lesser than Logistic Regression while having almost same recall. Precision improved a bit so F1 score also increased.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VbCD0ojetoVuM5OZ8ZUlIA.png" /><figcaption>Decision Trees Results</figcaption></figure><h4>3. Random Forest</h4><p>In Random Forest, 4 parameters were hyper-tuned.</p><pre>{&#39;max_depth&#39;: 15, &#39;max_leaf_nodes&#39;: 50, &#39;min_samples_split&#39;: 2, &#39;n_estimators&#39;: 200}</pre><p>We can see that the misclassification of points has significantly reduced but number of False Negatives has increased with a decrease in positive label accuracy. This means the model is predicting label 0 with better accuracy but is not able to predict label 1 properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RL4EABVnl82AK25C3JYe6Q.png" /><figcaption>Random Forest Results</figcaption></figure><h4>4. XG Boost</h4><p>In XG Boost, 3 parameters were hyper-tuned.</p><pre>{&#39;learning_rate&#39;: 0.2, &#39;max_depth&#39;: 6, &#39;subsample&#39;: 1}</pre><p>We can see that XG Boost has highest F1-score with least misclassification. It is working best on classifying labels as 0 but showing poor performance in classifying label 1 correctly. The number of True Negatives is highest in case of XG Boost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CJysP9aOoJGlJV2fagsJpA.png" /></figure><ul><li>I used SMOTE , oversampling algorithm to tackle the problem of imbalanced data but it did not make much difference in the results while making the model computationally expensive.</li><li>I also used Stacking Classifiers but the performance did not improve much, the misclassification of label 1 was still high.</li></ul><h3>10) Conclusion</h3><p>Overall best performance is given by Decision Trees, since our main objective is to make a model which can classify the negative reviews with maximum accuracy. So we would choose Decision Trees for our final model.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d58d6c3eadd110068281af59860bf19d/href">https://medium.com/media/d58d6c3eadd110068281af59860bf19d/href</a></iframe><h3>11) Deployment</h3><p>The web server is hosted by AWS and the web app is made by Streamlit.</p><pre>Streamlit web-app-  <a href="http://34.221.146.136:8501/">http://34.221.146.136:8501/</a></pre><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F734713713%3Fh%3D81c420313c%26app_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F734713713&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1478327000-17d942abf572fd1a94610323a4b046af164f6ae61fb7bbc55c972c64018c1455-d_1280&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/1eee4739dcc54148c895ad659e8e24a6/href">https://medium.com/media/1eee4739dcc54148c895ad659e8e24a6/href</a></iframe><h3>12) Future Work</h3><ul><li>More Feature Engineering can be done to get better results like</li></ul><p>— distance of seller to customer by using latitude and longitudes</p><p>— Average Product Value — cheaper products with low quality can result into customer dissatisfaction</p><ul><li>One could also use DL models for better results as they learn better.</li><li>The data is highly imbalanced, so we can only improve the results to some extent. With more data in the future, the results can be improved.</li></ul><h3>13) Links</h3><ul><li>Code link - <a href="https://github.com/MoJo005/Olist-Dataset">https://github.com/MoJo005/Olist-Dataset</a></li><li>Linkedin - <a href="http://www.linkedin.com/in/mojo005">www.linkedin.com/in/mojo005</a></li></ul><h3>14) References</h3><ul><li>Course - <a href="https://www.appliedaicourse.com/">https://www.appliedaicourse.com/</a></li><li>Research Paper - <a href="https://iopscience.iop.org/article/10.1088/1742-6596/1712/1/012044/meta">https://iopscience.iop.org/article/10.1088/1742-6596/1712/1/012044/meta</a></li><li>Research Paper - <a href="https://iopscience.iop.org/article/10.1088/1755-1315/58/1/012031/meta">https://iopscience.iop.org/article/10.1088/1755-1315/58/1/012031/meta</a></li><li>Research Paper - <a href="https://www.sciencedirect.com/science/article/abs/pii/S0045790621004869">https://www.sciencedirect.com/science/article/abs/pii/S0045790621004869</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63f5e408fa9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>