Skip to main content
QUICK REVIEW

[Paper Review] Identification of Twitter Bots Based on an Explainable Machine Learning Framework: The US 2020 Elections Case Study

Alexander Shevtsov, Christos Tzagkarakis|arXiv (Cornell University)|Dec 8, 2021
Spam and Phishing DetectionComputer Science5 citations
TL;DR

This paper proposes an explainable machine learning framework for detecting Twitter bots during the 2020 U.S. elections using XGBoost with SHAP-based interpretability. It achieves high detection accuracy by leveraging profile, temporal, and network-based features, with SHAP analysis revealing that bot accounts exhibit low list membership, low favoriting activity, and high rapid-following behavior.

ABSTRACT

Twitter is one of the most popular social networks attracting millions of users, while a considerable proportion of online discourse is captured. It provides a simple usage framework with short messages and an efficient application programming interface (API) enabling the research community to study and analyze several aspects of this social network. However, the Twitter usage simplicity can lead to malicious handling by various bots. The malicious handling phenomenon expands in online discourse, especially during the electoral periods, where except the legitimate bots used for dissemination and communication purposes, the goal is to manipulate the public opinion and the electorate towards a certain direction, specific ideology, or political party. This paper focuses on the design of a novel system for identifying Twitter bots based on labeled Twitter data. To this end, a supervised machine learning (ML) framework is adopted using an Extreme Gradient Boosting (XGBoost) algorithm, where the hyper-parameters are tuned via cross-validation. Our study also deploys Shapley Additive Explanations (SHAP) for explaining the ML model predictions by calculating feature importance, using the game theoretic-based Shapley values. Experimental evaluation on distinct Twitter datasets demonstrate the superiority of our approach, in terms of bot detection accuracy, when compared against a recent state-of-the-art Twitter bot detection method.

Motivation & Objective

  • To develop a supervised machine learning framework for identifying Twitter bots during high-stakes electoral periods, particularly the 2020 U.S. elections.
  • To investigate which features extracted from the Twitter API yield the highest performance in bot detection tasks.
  • To evaluate the generalization capability of the model across multiple well-established Twitter datasets beyond the primary training set.
  • To move beyond black-box models by enabling interpretability of predictions using SHAP values, thus revealing the rationale behind bot classification decisions.
  • To provide actionable insights into bot behavior patterns through feature importance analysis, supporting future detection and mitigation strategies.

Proposed method

  • The study employs a supervised machine learning pipeline using the XGBoost algorithm, optimized via k-fold cross-validation for hyperparameter tuning.
  • Features are extracted from Twitter API data, including profile metadata, temporal activity patterns, and network interaction metrics such as mentions, friends, and list memberships.
  • Ground truth labels are generated by aggregating predictions from two established online bot detection tools to improve labeling reliability.
  • A train/validation/test split is applied to ensure robust model evaluation, with SMOTE used for oversampling to address class imbalance.
  • SHAP (Shapley Additive Explanations) is applied to compute feature importance and interpret model predictions, using game-theoretic Shapley values to quantify each feature’s contribution to individual predictions.
  • The model’s performance is evaluated using standard metrics such as accuracy, precision, recall, and F1-score, with comparisons to a recent state-of-the-art method (Yang et al., 2020).

Experimental results

Research questions

  • RQ1Can a supervised machine learning model be effectively trained and fine-tuned on the US 2020 Elections Twitter dataset to achieve high bot detection accuracy?
  • RQ2Which combination of Twitter API-extracted features—profile, temporal, interaction, or network-based—yields the highest detection performance?
  • RQ3Does the proposed model generalize well across diverse, well-established Twitter datasets beyond the primary training set?
  • RQ4To what extent can the model’s decision-making process be interpreted and explained, particularly through feature importance analysis?
  • RQ5What behavioral patterns distinguish bot accounts from legitimate users, as revealed by explainable AI techniques like SHAP?

Key findings

  • The XGBoost model achieved superior bot detection accuracy compared to a recent state-of-the-art method (Yang et al., 2020), demonstrating strong performance on the US 2020 Elections dataset.
  • The feature 'listed_count' had the highest impact on model predictions, indicating that bot accounts are significantly less likely to be members of Twitter lists than normal users.
  • Bot users exhibited lower 'favourites_by_age' (likes per age), suggesting they tend to ignore or avoid engaging with the 'like' function on others’ tweets.
  • Bot accounts showed high 'friends_by_age' values, indicating rapid and aggressive following behavior to expand network visibility within short timeframes.
  • The SHAP summary plot revealed that top-20 impactful features were predominantly statistical, time-based, and graph-based, with 'listed_count', 'favourites_by_age', and 'friends_by_age' being among the most influential.
  • The model demonstrated strong generalization performance when applied to additional well-established Twitter datasets, confirming its robustness across different data distributions.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.