welcome
play

Welcome ! SE N TIME N T AN ALYSIS IN P YTH ON Violeta Mishe v a - PowerPoint PPT Presentation

Welcome ! SE N TIME N T AN ALYSIS IN P YTH ON Violeta Mishe v a Data Scientist What is sentiment anal y sis ? Sentiment anal y sis is the process of u nderstanding the opinion of an a u thor abo u t a s u bject . SENTIMENT ANALYSIS IN PYTHON


  1. Welcome ! SE N TIME N T AN ALYSIS IN P YTH ON Violeta Mishe v a Data Scientist

  2. What is sentiment anal y sis ? Sentiment anal y sis is the process of u nderstanding the opinion of an a u thor abo u t a s u bject . SENTIMENT ANALYSIS IN PYTHON

  3. What goes into a sentiment anal y sis s y stem ? First element : Opinion / emotion Opinion ( polarit y): pos , ne u tral , neg Emotion SENTIMENT ANALYSIS IN PYTHON

  4. What goes into a sentiment anal y sis s y stem ? Second element : s u bject S u bject of disc u ssion : What is being talked abo u t ? _ The camera on this phone is great b u t its ba � er y life is rather disappointing . _ Third element : opinion holder Opinion holder ( entit y): B y w hom ? SENTIMENT ANALYSIS IN PYTHON

  5. Wh y sentiment anal y sis ? Social media monitoring Not onl y w hat people are talking abo u t b u t HOW the y are talking abo u t it Sentiment can be fo u nd also in for u ms , blogs , ne w s Brand monitoring C u stomer ser v ice Prod u ct anal y tics Market research and anal y sis SENTIMENT ANALYSIS IN PYTHON

  6. Let ' s look at mo v ie re v ie w s ! data.head() SENTIMENT ANALYSIS IN PYTHON

  7. Ho w man y positi v e and negati v e re v ie w s ? data.label.value_counts() 0 3782 1 3719 Name: label, dtype: int64 SENTIMENT ANALYSIS IN PYTHON

  8. Percentage of positi v e and negati v e re v ie w s data.label.value_counts() / len(data) 0 0.504199 1 0.495801 Name: label, dtype: float64 SENTIMENT ANALYSIS IN PYTHON

  9. Ho w long is the longest re v ie w? length_reviews = data.review.str.len() type(length_reviews) pandas.core.series.Series # Finding the review with max length max(length_reviews) 0 667 1 2982 2 669 3 1087 .... SENTIMENT ANALYSIS IN PYTHON

  10. Ho w long is the shortest re v ie w? length_reviews = data.review.str.len() # Finding the review with min length min(length_reviews) 0 667 1 2982 2 669 3 1087 4 724 .... SENTIMENT ANALYSIS IN PYTHON

  11. Let ' s practice ! SE N TIME N T AN ALYSIS IN P YTH ON

  12. Sentiment anal y sis t y pes and approaches SE N TIME N T AN ALYSIS IN P YTH ON Violeta Mishe v a Data Scientist

  13. Le v els of gran u larit y 1. Doc u ment le v el 2. Sentence le v el 3. Aspect le v el The camera in this phone is pre � y good b u t the ba � er y life is disappointing . SENTIMENT ANALYSIS IN PYTHON

  14. T y pe of sentiment anal y sis algorithms R u le / le x icon - based nice :+2, good :+1, terrible : -3 ... Toda y w as a good da y. Today: 0, was:0, a:0, good:+1, day:0 Total valance: +1 A u tomatic / Machine learning SENTIMENT ANALYSIS IN PYTHON

  15. What is the v alance of a sentence ? text = "Today was a good day." from textblob import TextBlob my_valance = TextBlob(text) my_valance.sentiment Sentiment(polarity=0.7, subjectivity=0.6000000000000001) SENTIMENT ANALYSIS IN PYTHON

  16. A u tomated or r u le - based ? A u tomated / Machine learning R u le / le x icon - based Rel y on ha v ing labelled historical data Rel y on man u all y cra � ed v alance scores Might take a w hile to train Di � erent w ords might ha v e di � erent polarit y in di � erent conte x ts Latest machine learning models can be q u ite po w erf u l Can be q u ite fast SENTIMENT ANALYSIS IN PYTHON

  17. Let ' s practice ! SE N TIME N T AN ALYSIS IN P YTH ON

  18. Let ' s b u ild a w ord clo u d ! SE N TIME N T AN ALYSIS IN P YTH ON Violeta Mishe v a Data Scientist

  19. Word clo u d e x ample SENTIMENT ANALYSIS IN PYTHON

  20. Ho w do w ord clo u ds w ork ? The more freq u ent a w ord is , the BIGGER and bolder it w ill appear on the w ord clo u d . SENTIMENT ANALYSIS IN PYTHON

  21. Word clo u d generated b y one of the longest re v ie w s SENTIMENT ANALYSIS IN PYTHON

  22. Wh y w ord clo u ds ? Pros Cons Can re v eal the essential Sometimes conf u sing and u ninformati v e Pro v ide an o v erall sense of the te x t With larger te x t , req u ire more w ork Eas y to grasp and engaging SENTIMENT ANALYSIS IN PYTHON

  23. Let ' s b u ild a w ord clo u d in P y thon ! from wordcloud import WordCloud import matplotlib.pyplot as plt two_cities = "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness, it was the spring of hope, it was the winter of despair, we had everything before us, we had nothing before us, we were all going direct to Heaven, we were all going direct the other way – in short, the period was so far like the present period, that some of its noisiest authorities insisted on its being received, for good or for evil, in the superlative degree of comparison only." SENTIMENT ANALYSIS IN PYTHON

  24. Define the WordClo u d object cloud_two_cities = WordCloud().generate(two_cities) # To see all arguments of the function ?WordCloud Backgro u nd color Si z e and font of the w ords , scaling Stop w ords # How does cloud_two_cities look like? cloud_two_cities <wordcloud.wordcloud.WordCloud at 0x2585f286d68> SENTIMENT ANALYSIS IN PYTHON

  25. Disla y ing the w ord clo u d ! plt.imshow(cloud_two_cities, interpolation='bilinear') plt.axis('off') plt.show() SENTIMENT ANALYSIS IN PYTHON

  26. Let ' s practice ! SE N TIME N T AN ALYSIS IN P YTH ON

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend