[EXPLAINER] How the internet knows if you’re happy or sad

This article first appeared on The Conversation.

Think about what you shared with your friends on Facebook today. Was it feelings of “stress” or “failure”, or perhaps “joy”, “love” or “excitement”? Each time we post on social media, we leave traces of our mood.

Our emotions are valuable commodities, and many companies are developing automated tools to recognise them in a process known as sentiment analysis.

Recently, a leaked report revealed that Facebook can identify when young people are feeling vulnerable, although the company has insisted it did not use the analysis to target users with advertising. Facebook also apologised in 2014 for an experiment on “emotional contagion” in which posts with either “positive” or “negative” sentiment were filtered from users’ feeds.

Clearly, the ability to detect emotion from text is of great interest to social media companies, as well as advertisers. But how does sentiment analysis work, why is it useful and what are the dangers?

HOW DOES SENTIMENT ANALYSIS WORK?

While the details of Facebook’s own algorithm are not publicly known, most sentiment analysis techniques fall into two categories: supervised or unsupervised.

Supervised methods rely on labelled data. In other words, these are posts that have been classified manually as containing positive or negative sentiment.

Statistical methods are then used to train models to classify new posts automatically based on the presence of pre-identified words or phrases, for example “stressed” or “relaxed”.

Unsupervised methods, on the other hand, often rely on building a dictionary of scores for different words. One such dictionary developed by my collaborators asked people to give a 1 to 9 happiness score to different words, and then averaged the results: “rainbows”, for example, scored 8.06, while “useless” gets 2.52.

The overall sentiment of a phrase can then be scored by looking at all the words in the post. For example, the average score for the post “My momma always said ‘life is like a box of chocolates’” is an above-average 6.02 according to this dictionary, suggesting it expresses a positive feeling.

WHAT IS SENTIMENT ANALYSIS USED FOR?

Sentiment analysis is increasingly used by marketers to study trends and make product recommendations.

Imagine a new mobile phone is released; a sentiment analysis of social media posts about the phone may give a company valuable, real-time insight into how it’s performing.

There are broader applications of sentiment analysis. Researchers have recently tracked Donald Trump’s Twitter sentiment over the first 100 days of his presidency and built bots to place market trades when he tweets positively or negatively about specific companies.

Scientists can track emotional trends in other texts as well. For example, we used sentiment analysis to study the emotional arcs of more than 1,000 films through their screenplays. The arc of the 2013 Disney film Frozen is shown below.

WE’RE STILL NOT THAT GOOD AT SENTIMENT ANALYSIS

Given that sentiment analysis often relies on mining social media posts, it raises major ethical concerns, and this debate is only beginnning. Yet the complex nature of language and meaning makes it prone to error.

Take the phrase, “May the force be with you”, which scores 5.35 using our dictionary’s analysis. For any Star Wars fan, it is of course a hugely positive phrase, but it scored modestly in our test because the word “force” is rated a below-average 4.0.

This is understandable when rating this word in isolation, but in context it makes less sense.

Some scepticism of the validity of Facebook’s sentiment analysis capabilities is therefore warranted. It’s entirely conceivable that describing something as “fully sick” on Facebook, a phrase of colloquial endorsement, could lead to an individual’s emotional state being misclassified.

To understand when sentiment analysis does and doesn’t work, it is important to examine the words that drive particular results.

To do this, we use “word shift” diagrams, like the one below for Frozen. This shows which words made the climax of the screenplay sadder than its happy ending: more references to “sadness” and “fear”, but strangely, more “beautiful”.

PROMISE AND A WARNING

Sentiment analysis is a powerful tool, but it’s only a young science and must be used with caution.

Scientists must develop tools that allow us to peer “under the hood” and understand why certain algorithms produce the results they do. This is the only way to diagnose issues with different methods, and more importantly, to educate the public about the field’s possibilities and limitations.

Sentiment analysis research has largely been built on large, public data sets, particularly from social media. It’s important those of us unwittingly providing the data understand what it can and can’t be used for, and how.

Lewis Mitchell is a lecturer in applied mathematics, University of Adelaide.

The Conversation

This article first appeared on EWN : [EXPLAINER] How the internet knows if you’re happy or sad


702 welcomes all comments that are constructive, contribute to discussions in a meaningful manner and take stories forward.

However, we will NOT condone the following:

  • Racism (including offensive comments based on ethnicity and nationality)
  • Sexism
  • Homophobia
  • Religious intolerance
  • Cyber bullying
  • Hate speech
  • Derogatory language
  • Comments inciting violence.

We ask that your comments remain relevant to the articles they appear on and do not include general banter or conversation as this dilutes the effectiveness of the comments section.

We strive to make the 702 community a safe and welcoming space for all.

702 reserves the right to: 1) remove any comments that do not follow the above guidelines; and, 2) ban users who repeatedly infringe the rules.

Should you find any comments upsetting or offensive you can also flag them and we will assess it against our guidelines.

702 is constantly reviewing its comments policy in order to create an environment conducive to constructive conversations.

Popular articles
Dr Mbuyiseni Ndlozi opens up about his thesis

Dr Mbuyiseni Ndlozi opens up about his thesis

Ndlozi explains the significance of the the first chapter of his thesis: 'Trauma in the archives'.

German prosecutors probing Steinhoff CEO Markus Jooste (for accounting fraud)

German prosecutors probing Steinhoff CEO Markus Jooste (for accounting fraud)

The Money Show’s Bruce Whitfield interviews Steinhoff International Chairperson Christo Wiese.

Is it normal to have a curved penis? Dr Shingai explains

Is it normal to have a curved penis? Dr Shingai explains

Urologist Dr Shingai Mutambirwa says penile curvature is only a concern if it impedes a man's ability to have penetrative sex.

Nkosazana Dlamini-Zuma's simply did not do her job as  AU chair - analyst

Nkosazana Dlamini-Zuma's simply did not do her job as AU chair - analyst

Analysts weigh-in with very different views on Dlamini Zuma's failures and achievements as chairperson of the African Union.

Who is Advocate Tembeka Ngcukaitobi?

Who is Advocate Tembeka Ngcukaitobi?

The EFF lawyer stole the show during the state capture report court battle.

Meet Shoprite’s Christo Wiese, ruler of retail (and 3rd richest African)

Meet Shoprite’s Christo Wiese, ruler of retail (and 3rd richest African)

Bruce Whitfield interviews the remarkable Wiese (net worth R100 billion!) about how it all began and where it’s going.

3 easy questions could bag you R2000!

3 easy questions could bag you R2000!

WIN R2000! But only if you can prove you're a whiz of the MTN Biz Quiz by answering the following three questions...

Blesserfinder: Matching you with a sugar daddy near you

Blesserfinder: Matching you with a sugar daddy near you

Is social trend Blesserfinder, where girls are allegedly matching up with rich 'benefactors' in exchange for sex, a real thing?