News Release

An algorithm trained to detect unhappiness on social networks

Researchers have developed an algorithm that can identify the basic needs of users from the text and images they share on social networks

Peer-Reviewed Publication

Universitat Oberta de Catalunya (UOC)

According to William Glasser's Choice Theory, there are five basic needs that are central to all human behaviour: Survival, Power, Freedom, Belonging and Fun. These needs even have an influence on the images we choose to upload to our Instagram page. "How we present ourselves on social media can provide useful information about behaviours, personalities, perspectives, motives and needs," explained Mohammad Mahdi Dehshibi, who led this study within the AI for Human Well-being (AIWELL) group, which belongs to the Faculty of Computer Science, Multimedia and Telecommunications at the UOC.

The research team has spent two years working on a deep learning model that identifies the five needs described by Glasser, using multimodal data such as images, text, biography and geolocation. For the study, which has been published in the journal IEEE Transactions on Affective Computing, 86 Instagram profiles, in both Spanish and Persian, were analysed.

Drawing on neural networks and databases, the experts trained an algorithm to identify the content of the images and to categorize textual content by assigning different labels proposed by psychologists, who compared the results with a database containing over 30,000 images, captions and comments.

The problem of standardizing the labels obtained from texts and images was solved with a codebook, Bag-of-Content, which they described as a "semantic map from the visual to the textual domain". According to the researchers, the experiments "show promising accuracy and complementary information between visual and textual cues".


Spanish speakers mention their problems more often

Does each choice we make respond to just one basic need? Glasser's theory says otherwise, and the multi-label approach of this study is useful in clearing up this doubt. Dehshibi, currently a research scientist at Universidad Carlos III de Madrid's (UC3M) imBody reasearch laboratory and at the Unconventional Computing Laboratory, UWE Bristol, uses an example to explain this: "Imagine that a cyclist is riding up a mountain, and at the top, they can choose between sharing a selfie and a group photo. If they choose the selfie, we perceive a need for Power, but if they choose the other option, we can conclude that the person is not only looking for Fun but also a way to satisfy their need for Belonging".

In addition, the fact that the profiles analysed belong to people who communicate in two different languages avoids cultural bias. Previous studies have found, for example, that Spanish-speaking users are more likely to mention relationship problems when they are feeling depressed than English speakers. "Studying data from social networks that belong to non-English speaking users could help build inclusive and diverse tools and models for addressing mental health problems in people with diverse cultural or linguistic backgrounds," they noted. 

The authors believe that their research can help improve preventive measures, ranging from identification to improved treatment when a person has been diagnosed with a mental health disorder.


This UOC study supports Sustainable Development Goal (SDG) 3 (Good Health and Well-being).



The UOC's research and innovation (R&I) is helping overcome pressing challenges faced by global societies in the 21st century, by studying interactions between technology and human & social sciences with a specific focus on the network society, e-learning and e-health.

Over 500 researchers and 51 research groups work among the University's seven faculties and two research centres: the Internet Interdisciplinary Institute (IN3) and the eHealth Center (eHC).

The University also cultivates online learning innovations at its eLearning Innovation Center (eLinC), as well as UOC community entrepreneurship and knowledge transfer via the Hubbik platform.

The United Nations' 2030 Agenda for Sustainable Development and open knowledge serve as strategic pillars for the UOC's teaching, research and innovation. More information: 

Disclaimer: AAAS and EurekAlert! are not responsible for the accuracy of news releases posted to EurekAlert! by contributing institutions or for the use of any information through the EurekAlert system.