<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/web-scraping-influenster-find-a-popular-hair-care-product-for-you/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.nycdatascience.com/student-works/web-scraping-influenster-find-popular-hair-care-product/"> R – NYC Data Science Academy Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><img sizes="(max-width: 1024px) 100vw, 1024px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/StockSnap_A1AA9A2464-1024x683.jpg?w=450" alt="" class="wp-post-image" data-recalc-dims="1">
<p><span>Are you a person who likes to try new products? Are you curious about which hair products are popular and trendy? If you’re excited about getting your hair glossy and eager to find a suitable shampoo, conditioner or hair oil merchandise, using </span><a rel="nofollow" href="https://yuyuhan0306.shinyapps.io/Influenster/" target="_blank"><span>my ‘Shiny (Hair) App’</span></a><span> could help you find what you seek in less time. My codes are available on </span><a rel="nofollow" href="https://github.com/yuyuhan0306/Influenster_haircare" target="_blank"><span>GitHub</span></a><span>.</span></p>
<p> </p>
<p><b>Research Questions</b></p>
<p><span>What are popular hair care brands?</span></p>
<p><span>What is the user behavior on Influenter.com?</span></p>
<p><span>What kind of factors may have critical influences on customers satisfaction?</span></p>
<p><span>Is it possible to create a search engine, which takes charge of phrases and returns related products?</span></p>
<p> </p>
<p><b>Data Collection</b></p>
<p><span>To obtain the most up-to-date hair care information, I decided to web scrape </span><a rel="nofollow" href="https://www.influenster.com/" target="_blank"><span>Influenster</span></a><span>, a product discovery and review platform. It has over 14 million reviews and over 2 millions products for users to choose from.  </span></p>
<p><span>In order to narrow down my research scope, I focused on 3 categories: shampoo, hair conditioner, and hair oil. I garnered 54 top choices for each one. For product datasets, I scraped brand name, product name, overall product rating, rank and reviews. Plus, the web scraping review dataset includes author name, author location, content, rating score, and hair profile.</span></p>
<p> </p>
<p><b>Results</b></p>
<p><em><span>Top Brands Graph</span></em></p>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.37.57-AM.png" target="_blank"><img sizes="(max-width: 420px) 100vw, 420px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.37.57-AM-300x203.png?resize=420%2C284" alt="" class="wp-image-24000" data-recalc-dims="1"></a></p>
<p><span>Firstly, the “other” category represents the brands which have one or two popular products. Thus, judging from the popular brands’ pie chart, we can see that most of the popular products belong to huge brands.</span></p>
<p> </p>
<p><em><span>Rating Map</span></em></p>
<p><span><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.38.39-AM.png" target="_blank"><img sizes="(max-width: 439px) 100vw, 439px" src="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.38.39-AM-300x192.png?resize=439%2C281" alt="" class="wp-image-23999" data-recalc-dims="1"></a></span></p>
<p><span>As to checking users’ behaviors on Influenster in the United States, I decided to make two maps to see whether there are any interesting results linked to location. Since I scraped top 54 products for each category, the overall rating score is high across the country. As a result, it is difficult to see regional differences.</span></p>
<p> </p>
<p><em><span>Reviews Map</span></em></p>
<p><em><span><a rel="nofollow" href="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.38.51-AM.png" target="_blank"><img sizes="(max-width: 469px) 100vw, 469px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.38.51-AM-300x192.png?w=450" alt="" class="wp-image-23998" data-recalc-dims="1"></a> </span></em></p>
<p><span>However, if we take a look at the number of hair care product reviews on Influenster.com across the nation, we know that there are 4740, 3898, 3787, 2818 reviews in California, Florida, Texas and New York respectively. </span></p>
<p> </p>
<p><em><span>Analysis of Rating and Number of Reviews</span></em></p>
<p><span><em><a rel="nofollow" href="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.39.01-AM.png" target="_blank"><img sizes="(max-width: 487px) 100vw, 487px" src="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-9.39.01-AM-300x189.png?w=450" alt="" class="wp-image-23997" data-recalc-dims="1"></a></em></span></p>
<p><span>There is a negative relationship between rating and number of reviews. As you can see, Pureolog receives the highest score 4.77out of 5, but it only has 514 reviews. On the other hand, OGX is scored 4.4 out of 5, though, it gains over 5167 reviews.</span></p>
<p> </p>
<p><em><span>Wordcloud &amp; Comparison Cloud</span></em></p>
<p><a rel="nofollow" href="https://i1.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-12.58.44-PM.png" target="_blank"><img sizes="(max-width: 626px) 100vw, 626px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/Screen-Shot-2017-08-30-at-12.58.44-PM-300x196.png?w=450" alt="" class="wp-image-24012" data-recalc-dims="1"></a></p>
<p><span>As we may be interested in what factors customers care about most and what contributes to their satisfaction with a product, I decided to inspect the most frequently mentioned words in those 77 thousand reviews. For the first try, I created word clouds for each category and the overall reviews. However, there is no significant difference among the four graphs. Therefore, I created a comparison cloud to collate the most common words popping up in reviews.From the comparison cloud, we can infer that customers regard functionalities of products and fragrance as the most important. In addition, the word “recommend” shows up as a commonly used word in the reviews dataset. Consequently, in my perspective, word of mouth is a great marketing strategy for brands to focus on.</span></p>
<p> </p>
<p><span><strong>Search Engine built in <b>my Shiny App</b></strong> <strong>(NLP: TF-IDF, cosine similarity)</strong></span></p>
<div class="wp-video"><br>
<video width="450" controls="controls" class="wp-video-shortcode" preload="metadata"><source type="video/mp4" src="http://blog.nycdatascience.com/wp-content/uploads/2017/08/engine_demo.mp4?_=1"><a rel="nofollow" href="http://blog.nycdatascience.com/wp-content/uploads/2017/08/engine_demo.mp4" target="_blank">http://blog.nycdatascience.com/wp-content/uploads/2017/08/engine_demo.mp4</a></video></div>
<p><b>TF-IDF</b></p>
<p><span>TF-IDF is a NLP technique, which stands for “Term Frequency–Inverse Document Frequency,”, a numerical statistic that is intended to reflect how important a word is compared to a document in a corpus.</span></p>
<p><span>For my search engine, I utilize “tm” package and employ weightSMART “nnn” weighted schema for term frequency. Basically, the weightSMART “nnn”, a natural weighting computation, counts how many times each individual word matches up with the document in the dataset. If you would like to read more details and check more weighting schemas, please feel free to take a look at the </span><a rel="nofollow" href="https://www.rdocumentation.org/packages/tm/versions/0.7-1/topics/weightSMART?tap_a=5644-dce66f&tap_s=10907-287229" target="_blank"><span>R documentation</span></a><span>.</span></p>
<p><b>Cosine Similarity</b></p>
<p><span>With TF-IDF measurements in place, products are recommended according to a cosine similarity score with the query. To further elaborate how cosine similarity works, it is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them. In the case of information retrieval like a search engine, the cosine similarity of two documents will range from 0 to 1, because the term frequencies (TF-IDF weights) cannot be negative. In other words, the angle between two term frequency vectors cannot be greater than 90 degrees. Additionally, when the cosine value is closer to 1, it means that there is a higher similarity between the two vectors (products). The cosine similarity formula is shown below.</span></p>
<p> </p>
<p><a rel="nofollow" href="https://i0.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/cosinesimilarityfq1.png" target="_blank"><img sizes="(max-width: 764px) 100vw, 764px" src="https://i2.wp.com/blog.nycdatascience.com/wp-content/uploads/2017/08/cosinesimilarityfq1-300x84.png?w=450" alt="" class="wp-image-23996" data-recalc-dims="1"></a></p>
<p> </p>
<p><b>Insights</b></p>
<p><span>Most of the products belong to household brands.</span></p>
<p><span>The more active users of the site are from California, Florida, Texas and New York.</span></p>
<p><span>There is a negative relationship between the number of reviews and rating score.</span></p>
<p><span>Functions and the scent of hair care products are of great importance.</span></p>
<p><span>Even though “recommend” is a commonly used word, in this project, it is difficult to tell whether is positive or negative feedbacks. Thus, I can conduct sentiment analysis in the future.</span></p>
<p><span>The self-developed search engine, applied with TF-IDF and cosine similarity concepts, will work even better if I include product descriptions. By adding up product descriptions, users can have a higher probability to match their inputs to not only product name but product description, so that they are able to retrieve more related merchandises and explore new features of products.</span></p>
<p>The post <a rel="nofollow" href="http://blog.nycdatascience.com/student-works/web-scraping-influenster-find-popular-hair-care-product/" target="_blank">Web Scraping Influenster: Find a Popular Hair Care Product for You</a> appeared first on <a rel="nofollow" href="http://blog.nycdatascience.com/" target="_blank">NYC Data Science Academy Blog</a>.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.nycdatascience.com/student-works/web-scraping-influenster-find-popular-hair-care-product/"> R – NYC Data Science Academy Blog</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/LzWBirUcMXs" height="1"></a></div>