Algorithm can spot depressed Twitter users with nearly 90% accuracy

The algorithm determines someone’s mental state by extracting and analyzing 38 data points from their public Twitter profile.

[Apr 8, 2022: Tim Pilgrim, Brunel University]

A newly developed algorithm can spot depression in Twitter users with 88.39 percent accuracy. (CREDIT: Creative Commons)

A newly developed algorithm can spot depression in Twitter users with 88.39% accuracy. Developed by researchers at Brunel University London and the University of Leicester, the algorithm determines someone's mental state by extracting and analyzing 38 data points from their public Twitter profile, including the content of their posts, their posting times, and the other users in their social circle.

The research team say similar systems could have a range of different uses in the future across multiple platforms, such as early depression diagnosis, employment screening or police investigations.

"We tested the algorithm on two large databases and benchmarked our results against other depression detection techniques," said Prof Abdul Sadka, Director of Brunel's Institute of Digital Futures. "In all cases, we've managed to outperform existing techniques in terms of their classification accuracy."

The algorithm was trained using two databases that contain the Twitter history of thousands of users, alongside additional information about those users' mental health. Eighty percent of the information in each database was used to teach the bot, with the other 20% then used to test its accuracy.

The bot works by first excluding all users with fewer than five tweets and running the remaining profiles through natural language software to correct for misspellings and abbreviations.

It then considers 38 distinct factors—such as a user's use of positive and negative words, the number of friends and followers they have, and their use of emojis—and makes a determination on that user's mental and emotional state.


Related Stories


Using the Tsinghua Twitter Depression Dataset, the team managed an accuracy of 88.39%, while an accuracy of 70.69% was achieved using John Hopkins University's CLPsych 2015 dataset.

"Anything that's above 90% is considered excellent in machine learning. So, 88% for one of the two databases is fantastic," said Prof Sadka.

"It's not 100% accurate, but I don't think at this level any machine learning solution can achieve 100% reliability. However, the closer you get to the 90% figure, the better."

The team say that such a system could potentially flag a user's depression before they post something into the public domain, paving the way for platforms such as Twitter and Facebook to proactively flag mental health concerns with users.

However, the bot can also be used after a post has made it into the public domain, potentially allowing employers and other businesses to assess a user's mental state based on their social media posts. It could be used for a number of reasons, the researchers say, including for use in sentiment analysis, criminal investigations or employment screening,

"The proposed algorithm is platform independent, so can also be easily extended to other social media systems such as Facebook or WhatsApp," said Prof Huiyu Zhou, Professor of Machine Learning at the University of Leicester.

"The next stage of this research will be to examine its validity in different environments or backgrounds, and more importantly, the technology raised from this investigation may be further developed to other applications, such as e-commerce, recruitment examination or candidacy screening."

The research, "Cost-sensitive Boosting Pruning Trees for depression detection on Twitter," was published in IEEE Transactions on Affective Computing.

For more science and technology news stories check out our New Innovations section at The Brighter Side of News.


Note: Materials provided above by Brunel University. Content may be edited for style and length.

Like these kind of feel good stories? Get the Brighter Side of News' newsletter.


Tags: #Twitter, #New_Innovations, #Depression, #Human_Behavior, #Neuroscience, #Research, #Science, #Algorithm, #The_Brighter_Side_of_News


Joseph Shavit
Joseph ShavitSpace, Technology and Medical News Writer
Joseph Shavit is the head science news writer with a passion for communicating complex scientific discoveries to a broad audience. With a strong background in both science, business, product management, media leadership and entrepreneurship, Joseph possesses the unique ability to bridge the gap between business and technology, making intricate scientific concepts accessible and engaging to readers of all backgrounds.