Predicting Social Media Engagement from Sentiment and Contextual Features Using Machine Learning
Main Article Content
This study investigates how emotional sentiment and contextual features influence audience engagement on social media platforms using machine learning techniques. A dataset of 732 social media posts from multiple platforms was analyzed to identify the relationship between sentiment, content characteristics, and engagement levels. Sentiment normalization categorized posts into three main classes: positive, neutral, and negative. The analysis revealed that positive and neutral posts received higher engagement compared to negative ones, indicating that audiences are more responsive to emotionally uplifting or balanced content. Contextual factors such as text length, posting hour, and platform type also significantly affected engagement, with longer posts and strategically timed publication achieving greater interaction. Two predictive models, Random Forest and XGBoost, were employed to estimate engagement levels based on these features. The XGBoost model outperformed the baseline, achieving lower prediction error and explaining 22 percent of engagement variance, demonstrating its ability to capture complex nonlinear relationships. Feature importance analysis identified text length as the strongest predictor, followed by posting hour, country, and sentiment, while hashtag count showed minimal influence. The findings highlight that engagement in digital environments is shaped by both emotional and contextual dimensions, reflecting the interplay between user psychology, communication strategy, and platform design. This research contributes to the growing field of digital society studies by showing how artificial intelligence can be used to model and interpret human interaction patterns in online spaces.