SlideShare a Scribd company logo
1 of 25
Download to read offline
Sentiment Analysis
Mariateresa Roccato
Mariia Borisova
Elisa Paiusco
Sommario:
• Introduzione alla SA
• Approcci della SA
• Applicazione della SA
Social media oggi…
Monthly Active Users
All Users
330 Million
Tweets per day
All Users
500 Million
Monthly Active Users
All Users
1 940 Million
Daily Active Users
All Users
1 280 Million
Twitter Facebook
Come possiamo dare valore ai dati grezzi dei social media?
Social media mining è il procedimento che permette di
estrarre informazioni utili dai social media
La Sentiment Analysis:
•è l’analisi computazionale di sentimenti e opinioni
espressi in Rete
•è uno strumento di indagine che consente di
classificare le emozioni contenute in un testo
La Sentiment Analysis determina:
• la polarità, ovvero l’orientamento dell’opinione sia essa
positiva, negativa o neutra
• l’intensità di tale opinione
• l’emotività con cui questa è espressa (attraverso l’uso di
aggettivi, punteggiatura, emoticons, ecc) e la rilevanza
dell’oggetto d’analisi rispetto al contesto.
A che domande può rispondere
la Sentiment Analysis?
Film: Questa recensione è positiva o negativa?
Prodotto: Che cosa pensano i consumatori del nuovo iPhone?
Sentimento
pubblico:
Qual è l’indice di fiducia del consumatore?
Politica: Che cosa pensano di questo candidato o questo problema?
Previsione: Previsione delle elezioni o dell’andamento di mercato
Approcci
della Sentiment
Analysis
Approccio lessicale
•Utilizzo di un dizionario con informazioni riguardanti la
positività/negatività di parole o frasi.
•La polarità di un testo viene determinata in base alla
polarità dei termini che lo compongono
•Pro: nessun addestramento richiesto
•Contro: basati sulla coerenza del lessico
Biblioteca SentiWordNet
• Stefano Baccianella, Andrea
Esuli, and Fabrizio Sebastiani
• Istituto di Scienza e Tecnologie
dell’Informazione Consiglio
Nazionale delle Ricerche
• http://sentiwordnet.isti.cnr.it/
• Tutte le parole WORDNET sono
annotate verso “positivity”,
“negativity” and “neutrality”
Negativo
Incubo
Pessim
a
Maled
ucati
Positivo
Consigl
iato
Elegant
e
Raffina
to
Biblioteca
Approccio Lessicale:
Approccio Machine Learning - Naive Bayes
•Partendo da esempi pre-etichettati, si addestra un
classificatore in grado di predire la polarità di un testo
precedentemente non noto
•Pro: più performanti rispetto agli approcci lessicali
•Contro: lunghi tempi di addestramento; necessaria
un’etichettatura manuale
Approccio Machine Learning - Naive Bayes
Allenamento
del
classificatore
Train
Prova
Test
Risultato
Get Sentiment
Allenamento del classificatore (TRAIN)
Rimuovi le
Stop Words
Etichetta è
positiva?
Calcola la
probabilità
Metti nel
Pickle File
YES
Calcola la
probabilità
Metti nel
Pickle File
NO
𝑃 𝑤 𝑐 =
𝑃(𝑤 ∩ 𝑐)
𝑃(𝑐)
Formula di Bayes:
W – parola
C – giudizio/sentimento
Prova del classificatore (TEST) e risultato
Input Test
Data
C’è nel
Pickle File?
Prendi la
probabilità
YES
Calcola la
probabilità
Sommare le probabilità per ogni parola
NO
Il risultato
è positivo?
Positivo
YES
Negativo
NO
(TRAIN)
Esempio:
Analisi della polarità delle parole dal sito IMDB
PoXs, Christopher. 2011. On the negativity of negation. SALT 20, 636-659.
Applicazione
della
Sentiment
Analysis
iPhone X sentiment analysis subito dopo la
presentazione di Apple
The UBER case study
Facebook: 34,173 Comments
News: 4,245 Articles Twitter: 21,603 Tweets
FIFA World Cup Russia 2018 Sentiment
Analysis
iHappy 2015: la felicità degli italiani, città per città
(e minuto per minuto)
20 MARZO 2016 | di Voices from the Blogs
Sentiment Analysis
of Tweets to Gain
Insights
into the 2016 US
Election
by Tim Hamling, Ankur Agrawal
Department of Computer Science,
Manhattan College, New York
Sentiment Analysis in Phyton
con tweepy e textblob
32,9
6,4
60,7
SA for “FIFA Russia
2018” based on 1000
tweets
Positivo
Negativo
Neutro
Sentiment analysis 12.07.2018

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Sentiment analysis 12.07.2018

  • 2. Sommario: • Introduzione alla SA • Approcci della SA • Applicazione della SA
  • 3. Social media oggi… Monthly Active Users All Users 330 Million Tweets per day All Users 500 Million Monthly Active Users All Users 1 940 Million Daily Active Users All Users 1 280 Million Twitter Facebook
  • 4. Come possiamo dare valore ai dati grezzi dei social media?
  • 5. Social media mining è il procedimento che permette di estrarre informazioni utili dai social media
  • 6. La Sentiment Analysis: •è l’analisi computazionale di sentimenti e opinioni espressi in Rete •è uno strumento di indagine che consente di classificare le emozioni contenute in un testo
  • 7. La Sentiment Analysis determina: • la polarità, ovvero l’orientamento dell’opinione sia essa positiva, negativa o neutra • l’intensità di tale opinione • l’emotività con cui questa è espressa (attraverso l’uso di aggettivi, punteggiatura, emoticons, ecc) e la rilevanza dell’oggetto d’analisi rispetto al contesto.
  • 8. A che domande può rispondere la Sentiment Analysis? Film: Questa recensione è positiva o negativa? Prodotto: Che cosa pensano i consumatori del nuovo iPhone? Sentimento pubblico: Qual è l’indice di fiducia del consumatore? Politica: Che cosa pensano di questo candidato o questo problema? Previsione: Previsione delle elezioni o dell’andamento di mercato
  • 10. Approccio lessicale •Utilizzo di un dizionario con informazioni riguardanti la positività/negatività di parole o frasi. •La polarità di un testo viene determinata in base alla polarità dei termini che lo compongono •Pro: nessun addestramento richiesto •Contro: basati sulla coerenza del lessico
  • 11. Biblioteca SentiWordNet • Stefano Baccianella, Andrea Esuli, and Fabrizio Sebastiani • Istituto di Scienza e Tecnologie dell’Informazione Consiglio Nazionale delle Ricerche • http://sentiwordnet.isti.cnr.it/ • Tutte le parole WORDNET sono annotate verso “positivity”, “negativity” and “neutrality”
  • 13. Approccio Machine Learning - Naive Bayes •Partendo da esempi pre-etichettati, si addestra un classificatore in grado di predire la polarità di un testo precedentemente non noto •Pro: più performanti rispetto agli approcci lessicali •Contro: lunghi tempi di addestramento; necessaria un’etichettatura manuale
  • 14. Approccio Machine Learning - Naive Bayes Allenamento del classificatore Train Prova Test Risultato Get Sentiment
  • 15. Allenamento del classificatore (TRAIN) Rimuovi le Stop Words Etichetta è positiva? Calcola la probabilità Metti nel Pickle File YES Calcola la probabilità Metti nel Pickle File NO 𝑃 𝑤 𝑐 = 𝑃(𝑤 ∩ 𝑐) 𝑃(𝑐) Formula di Bayes: W – parola C – giudizio/sentimento
  • 16. Prova del classificatore (TEST) e risultato Input Test Data C’è nel Pickle File? Prendi la probabilità YES Calcola la probabilità Sommare le probabilità per ogni parola NO Il risultato è positivo? Positivo YES Negativo NO (TRAIN)
  • 17. Esempio: Analisi della polarità delle parole dal sito IMDB PoXs, Christopher. 2011. On the negativity of negation. SALT 20, 636-659.
  • 19. iPhone X sentiment analysis subito dopo la presentazione di Apple
  • 20. The UBER case study Facebook: 34,173 Comments News: 4,245 Articles Twitter: 21,603 Tweets
  • 21. FIFA World Cup Russia 2018 Sentiment Analysis
  • 22. iHappy 2015: la felicità degli italiani, città per città (e minuto per minuto) 20 MARZO 2016 | di Voices from the Blogs
  • 23. Sentiment Analysis of Tweets to Gain Insights into the 2016 US Election by Tim Hamling, Ankur Agrawal Department of Computer Science, Manhattan College, New York
  • 24. Sentiment Analysis in Phyton con tweepy e textblob 32,9 6,4 60,7 SA for “FIFA Russia 2018” based on 1000 tweets Positivo Negativo Neutro