Sentiment Analysis of Amazon's deteriorated Product Ratings

Posted on Oct 23, 2021

Github| Sweta Prabha Linkedin 

Introduction

Sentiment Analysis, also known as opinion mining is a sub of Natural Language Processing that helps businesses to understand the brand and product sentiments of a consumer. It helps enterprises to gauge customers’ opinions through analysis of reviews, blogs, social media, news, etc. to conduct market research and predict the market trends to cater products accordingly. Sentiment-bearing phrases are identified from broken down texts collected through different sources and a sentiment score is assigned. In more sophisticated models, multiple layer scores are combined for analysis. For this project, I have performed a sentiment analysis of amazon's beauty product that dropped its rating from 2014 to 2021. A starter data set containing product features including ratings and reviews from 2014  is used for comparison with newly scraped reviews and ratings of the same product. The project is divided into four parts. Data Scraping, Data Cleaning, Exploratory Data Analysis, and Sentiment Analysis. This is unsupervised Machine Learning as there is no target variable.

Data Scraping

The first step was data collection. The majority of time on this project was spent cleaning and scraping data. Raw text data for amazon's beauty products containing 9 features and 12101 unique asins was downloaded from the UCSD repository which is shared with the public for research purposes. Fig 1 shows the 9 features downloaded from the repository. The unique asin numbers were put on a list for future scrapping using selenium and beautiful soup. Fig 2 shows the 7 features extracted from 2021 of 4242 unique asins for the products that are still available in 2021.

Data Cleaning

The two datasets were merged on unique asin numbers. Unwanted columns were removed and 12 features were retained for analysis. The dataset was stored in pandas data frame and data cleaning was done using regular expression and nltk libraries. nltk is a text preprocessing library that is frequently used in NLP. The reviews from 2014 and 2021 were prepared for further analysis by converting all texts to lower case, formatting empty space, expanding contractions (eg mgmt. to management), filtering punctuation and stop words (like have, has), and finally lemmatization (the process of extracting root words, eg. better: lemma good). Fig 3 lists all the 12 features in the the final data frame that will be used for further analysis.

Fig 3. Features in the final dataframe

Exploratory Data Analysis

The old and scraped data was visualized for any trend in buying habits within each category. Graph 1 shows the top 10 categories in terms of count within the given dataset of amazon's beauty products. It can be seen that most products are listed within skincare, haircare and makeup categories. The product features from these 3 groups are separated for further exploratory analysis. Graph 2 shows the distribution of price within the products for each of the 3 top groups. It can be seen that hair products have the highest range of prices.

Skincare Products:

Skincare products comprises the majority of amazon's beauty and health product within the dataset. For this project, number of product ratings is considered an estimation of number of sales. Fig 3.i) indicates the distribution of number of products within each price range. Fig 3.iii) is a microscopic view of graph 3.ii) showing the number of ratings (which in turn is an estimate of number of sales) for each price range in skincare products. It can be seen that maximum products are listed between 10-20$ and that's about the range which attracts highest number of customers.

 

Haircare Products:

Haircare products are the second-highest number after skincare products from this dataset. Fig 4. i), ii) and iii) follow the same pattern for hair care products as Fig 3 for skincare products. It was seen that customers usually spend more money online on hair products than skincare or makeup products. On the contrary, there is comparatively lesser number of products listed in the range of $30-$50, and based on the given buying pattern, more products in this range can be listed.

Makeup Products:

Makeup products are the third-largest number sold in beauty and health category from the dataset. There is a trend of people spending the least on makeup products. Most products are listed in the range of $0-10 and also the maximum reviews (sales) is seen in the same range.

Top 10 products that dropped ratings from 2014-2021

The difference of rating for each product in the three groups from 2014-2021 was calculated and top 10 products with highest drop were analyzed. Fig 7. ,8 and 9 gives the top 10 products in each categry with the highest drop. The sentiment analysis for these products will be done to understand the trend and change in opinion for each of these product categories.

Fig 7. Top 10 skincare products that dropped ratings in last 6 years

 

Fig 8. Top 10 haircare products that dropped ratings between 2014-2021

 

Fig 9. Top 10 haircare products that dropped ratings between 2014-2021

Sentiment Analysis

Since the sentiment analysis was done on the deteriorated product ratings, the polarity was assumed to be negative. Word cloud and N-gram was used for Natural Language Processing. For this project, the reviews of all 10 products in each category were concatenated to observe if anything stood out. Ideally, comparison of word cloud for each brand should be done to understand the sentiment towards the brand but since the number of reviews scraped for each product was between five to eight, all reviews were concatenated for a better understanding.

Findings and Recommendations

Skincare Products:

Wordcloud (single words and 2N-grams) for skincare products

Recommendations

For skincare category of amazon's beauty products,

  • There are more reviews with words like can not, not really, not work, not know in 2021 compared to 2014 implying quality of products have gone down
  • The phrase side effects has been used frequently in 2021 and from sellers' point of view, contents of the product can be reevaluated for any side effect causing factor
  • Words like soft, smooth were more frequent in 2014 but hard, dry is seen more in 2021, change in ingredients could be tracked
  • not really was used frequently in 2014 too indicating sign of complaints in 2014 and could be inspected back then
  • word cloud for reviews each of the 10 products can give a much better picture about how the sentiment of customers changed over 6 year

Hair care Products:

Wordcloud (single words and 2N-grams) for haircare products

Recommendations

  • Phrases like can not, not work, not really have increased in the reviews of 2021
  • shampoo conditioner 2 in 1 appears frequently which could be possible reason for reduced quality
  • Word related to smell like coconut smell appears in 2014 reviews and old smell in 2021. This can be further analyzed
  • spray nozzle appears a lot in 2021 and not in 2014, which could be a possible trend
  • kid hair, tear free appeared more frequently in 2014, implying possible change in ingredients by 2021

Makeup Products:

Wordcloud (single words and 2N-grams) for haircare products

Recommendations

not work, would not are the most appeared phrases in 2021 reviews implying drop in popularity from 2014

• Lot of discussion around the word color, like hot pink, purple lipstick, black lipstick in 2021 compared to just pink in 2014 implying possible change in taste

100% Pure has been used a lot in 2021, which could be possible concern about ingredients in the products

Conclusion and Future Work

Sentiment Analysis can be used in e-commerce industry to understand the trend and improve brand value. In this project word cloud was used to analyze the changing trend and figure out customer concerns through reviews. This work can be further extended by scraping more reviews for each product and studying the changing sentiment and factors effecting the drop in popularity of each product.

 

Reference:

Ups and downs: Modeling the visual evolution of fashion trends with one-class collaborative filtering
R. He, J. McAuley WWW, 2016

Image-based recommendations on styles and substitutes
J. McAuley, C. Targett, J. Shi, A. van den Hengel SIGIR, 2015

 

 

 

 

 

 

About Author

SWETA PRABHA

Data Scientist with 5 years experience in Academic Research and supply chain Industry. Expertise in Problem Solving, statistical analysis and machine learning models.
View all posts by SWETA PRABHA >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp