Poring Over Public Sentiment: Deep Learning Unmasks Twitter’s Take on Soda Taxes 

This entry is part 8 of 12 in the series September 2023

Leveraging Twitter data and deep learning, this research provides a comprehensive insight into public sentiment towards soda taxes, highlighting the role social media can play in policy making. 

In our recently published study, “Sentiment Analysis of Tweets on Soda Taxes,” we have merged the fields of artificial intelligence and public health to get a pulse on public sentiment regarding soda taxes in the US, a topic intertwined with the country’s persistent struggle against obesity. 

Sugar-sweetened beverages have been long identified as key contributors to obesity. As a part of the solution, soda taxes have been introduced as a tool to reduce the consumption of these beverages. However, the success of such policies significantly hinges on public opinion. With this in mind, we turned to Twitter, the vast public square of the digital age, to capture the pulse of the public sentiment toward soda taxes. 

Our research began by designing a search algorithm to systematically identify and collect tweets related to soda taxes from January 2015 to April 2022. We predetermined four mutually exclusive categories, namely “positive,” “negative,” “neutral,” and “link to news.” After manually labeling 5,000 tweets into four categories, we used them to train natural language processing (NLP) models. The finalized model we developed demonstrated an accuracy of 88%, with an F1 score of 0.87. Then we used the final NLP model to classify the entire over 370,000 tweets dataset by sentiments and calculated the overall prevalence of the four sentiments and tracked their annual trends. In addition, we performed a random forest classifier model to assess the covariates associated with the four categories and calculated the standardized feature importance from the random forest model concerning five tweet-specific covariates—number of followers, number of tweets the author posted, number of retweets, number of replies, and number of likes. 

Our findings provided a unique insight into the evolving public sentiment on soda taxes. Public attention paid to soda taxes, indicated by the number of tweets posted annually, peaked in 2016 but has declined considerably ever since. The decreasing prevalence of tweets quoting soda tax-related news without revealing sentiments coincided with the rapid increase in tweets expressing a neutral sentiment toward soda taxes. The prevalence of tweets expressing a negative sentiment rose steadily from 2015 to 2019 and then slightly leveled off, whereas that of tweets expressing a positive sentiment remained unchanged. Excluding news-quoting tweets, tweets with neutral, negative, and positive sentiments occupied roughly 56%, 29%, and 15% during 2015-2022, respectively. Authors’ total number of tweets posted, followers, and retweets predicted tweet sentiment. 

While social media has the power to mold public opinion and drive social change, it is often underused in informing governmental decision making. Analyzing social media sentiments could aid in the designing, implementing, and modifying of soda tax policies to ensure social backing while minimizing misinterpretations and confusion. This research also underscores the untapped potential of AI in understanding public sentiment, and its influence on policy making. This method can be extended to other areas of public health policy, offering a novel way of leveraging social media data for improved policy making. 

For an in-depth look at our research methods and findings, check out our recently published article, “Sentiment Analysis of Tweets on Soda Taxes.” We eagerly look forward to more discussions and insights on this crucial topic in advancing public health. 


Ruopeng An, PhD, MPP, is an Associate Professor at Washington University in St. Louis. His research aims to develop a well-rounded knowledge base and policy recommendations that can inform decision making and the allocation of resources to combat obesity.

Yuyi Yang, MPH, is a doctoral candidate at Washington University in St. Louis, specializing in computational and data sciences. She is passionately invested in leveraging artificial intelligence methodologies to innovate and transform the healthcare industry.

Quinlan Batcheller, MPH, is a graduate from Washington University in St. Louis Brown School of Public Health. He is primarily interested in the applications of artificial intelligence in both public health and clinical settings to revolutionize these fields of study.

Qianzi Zhou, MPH, is a recent MPH graduate at Washington University in St. Louis, passionate about population health and genomics. With a strong interest in statistics and computer science, Qianzi analyzes medical and biological data, aiming to contribute to health interventions through innovative approaches.

Series Navigation<< Public Health Departments Have New Workforce Funding: Time to Dust Off Those Job DescriptionsBalancing Two Priorities: First Responder Safety and Personal Privacy >>

Sign up for our newsletter!

To receive news and information about the Journal of Public Health Management and Practice and JPHMP Direct.

We don’t spam! Read our privacy policy for more info.