Predicting Twitter User Tendencies with Graph Machine Learning
Social media platforms like Twitter have long been recognized as spaces where users actively express their political views. As a result, there have been ongoing efforts to analyze such data to understand the political landscape and trends in public opinion.
In online spaces such as Twitter, users do more than merely write texts; they express their opinions by retweeting content from and connecting with others who share similar political views.
Although opinions form and spread within network structures, exhibiting distinctive group behaviors and patterns, conventional methods fail to adequately reflect these relational characteristics.
This article introduces a case study of graph machine learning predicting individual user's political orientations based on Twitter retweet data.
The model utilizing network analysis and graph machine learning proved effective in predicting user's political orientations.
Background
Limitations of Traditional Text Analysis and Machine Learning Models
Previous studies on political orientation analysis have long relied on text-based methods or traditional machine learning techniques.
In particular, prior studies utilizing Twitter data have primarily classified users' political positions based on word frequencies in posts, sentiment scores, or the presence of specific hashtags.
However, in online spaces such as Twitter, users go beyond merely posting texts; they express their views by retweeting content from and connecting with individuals who share similar political perspectives.
Although opinions form and spread within network structures, exhibiting distinctive group behaviors and patterns, traditional text analysis or machine learning models have limitations in adequately capturing these user interactions or the collective structures underlying opinion formation.
Core Idea
Classifying Political Orientation Using Retweet Network Data Among Users
This article proposes four classification models to categorize users' political orientations.
A machine learning model based on users' hashtag data
A machine learning model based on network analysis results
A machine learning model based on users' hashtag data combined with network analysis results
A graph machine learning model based on users' hashtag data, network analysis results, and retweet network data among users
Unlike traditional machine learning models that classify based solely on individual user information, graph machine learning incorporates not only features from a single user but also relational data with other users. This allows it to capture subtle opinion alignments and intra-group diffusion patterns, offering a more precise and robust classification of political orientation.
Solution
Step 1. Constructing the Retweet Network Data Among Users
In this study, we collected a retweet network among users and a user–hashtag usage network related to search keywords for Candidate A, spanning approximately one month from January to February 2022.
User Information(Nodes): User ID, hashtags, political orientation per user; a total 80,963 users
Retweet Relationships between users(Links): Comprised of a total 12,780 links
<Example of a Retweet Network Between Users>
User ID(Source) | User ID(Target) | Retweet Count (Weight) |
user_01 | user_02 | 8 |
user_03 | user_04 | 6 |
user_01 | user_03 | 1 |
The collected retweet network among users is analyzed using component analysis to extract the largest connected component (Giant Component).
Subsequently, the results from community detection within the extracted giant component are utilized as features for each user.
<Retweet Network Among Users>

Step 2. Construct User Features
Based on the collected user hashtag data, a network is constructed and then converted into a matrix format. This matrix is used both for analyzing user communities and as user features for training a model to classify their political orientation.
<Example of a Model input data>
Step 3. Construction of Political Orientation Classification Model
Finally, a model is built to classify users' political orientations.
We compared traditional machine learning models such as Logistic Regression, CART, and MLP with a graph machine learning classification model using GCN (Graph Convolutional Networks).
The input data used for prediction is as follows.
User's hashtag data
Results from network analysis
Users' hashtag data combined with network analysis results
Users' hashtag data, network analysis results, and retweet network data among users
We trained machine learning and graph machine learning models using four different types of input data and compared their performance.
Result
Classifying User's Political Orientation Using Graph Machine Learning
The GCN model, which utilizes users' hashtag data, network analysis results, and retweet network data, outperformed other classification models by 1 to 8 percentage points in accuracy.
This demonstrates that incorporating retweet relationships among users through graph machine learning leads to improved classification performance, compared to models that rely solely on hashtag usage or network analysis results.
<Accuracy Results by Classification Model> ㅇㄹㅇ
Political orientation classification has traditionally relied on text-based features or individual user data, making it difficult to capture relational context or interactions between groups. Political groupings and flows of influence formed through user connections, such as retweet networks, are challenging to detect using conventional machine learning models
However, classification models based on graph machine learning go beyond textual features and incorporate structural information such as "who is connected to whom", enabling much more precise and realistic classification of political orientation.
CYRAM Inc.
1660-4230 | netminer@cyram.com