senior year honors thesis that focused on predicting the user engagement of a tweet during the 2022 election season in Kenya
General elections in Kenya are often an intense time that generate many conversations across different platforms, including X (previously Twitter). Kenyans use X during election seasons to express their views on different political and socio-economic issues. As such, X can provide insights into the attitudes Kenyans have regarding certain issues during an election year. The purpose of this research is to determine the main topics Kenyans were discussing on X as they prepared for the 2022 general elections and to use those topics as inputs to a machine learning model to predict the level of engagement of a tweet. Using a dataset available on Kaggle, an open source platform for data science enthusiasts, we first apply data visualization techniques to explore tweet characteristics, such as number of followers. We then use text pre-processing methods to prepare the text of the tweets for topic modeling, an unsupervised learning technique within Natural Language Processing that involves grouping tweets into broader topics. Ultimately, a new variable is added to our dataset that contains the topic of each tweet. Finally, we use the topic modeling results and other key variables to build a machine learning model to predict the user engagement of a tweet, which is measured as a function of the number of likes and retweets. We hope the results of this research can provide guidance to Kenyan political leaders on how to tailor political messages to accurately address the concerns of Kenyans in the next election season.