# Detecting Social Media Bots with Variational AutoEncoder and k-Nearest Neighbor
## 3 Social Media Bot Detection
### Feature Extraction  
In this paper, the sample dataset is represented as \(\mathrm{X}=\{\mathrm{x_{i}}\}_{i=1}^{\mathrm{N}}\mathrm{x_{i}}=\{\mathrm{x_{i1} },\ldots,\mathrm{x_{i1}}\}\), where \(\mathrm{x_{i1}}\) represents the \(l\)th eigenvalue of sample \(i\) in the eigenmatrix and \(l\) represents the feature dimension of the sample in the feature matrix. In order to describe the human intervention behind social network accounts, the detection model needs to use a variety of features. Features can be classified into five types, including content features, emotional features, account information features, user activity features, and network features [13]. Most of the features selected in studies come from these categories, and all of them are used for classification. According to the characteristics of the selected dataset, this paper extracts several high-usage content features and user activity features. Content features are message-related features, which are obtained through message analysis. User activity characteristics include any measure of how often users post tweets, the similarity between multiple tweets published by users, and how users post tweets (e.g., through mobile devices, web interfaces, or automated tools). In this type of feature, some statistical indicators are calculated according to some or all tweets of users, and the statistical characteristics are expressed as the ratio between the number of times an element appears and the number of tweets. The common features extracted in this paper are as follows. 1. The average number of mentions in tweets is \(x_{i1}\): social media bots and normal users refer to other users for some special purpose, which leads to different proportions of tweets containing @ in all tweets. The definition of this indicator is as follows: \[x_{i1}=\frac{Mention_{i}}{Total_{i}}\] (1)  
The meaning of Total\({}_{i}\) in Equations (1) and (2) is the total number of tweets sent by sample i. \(Mention_{i}\) is the total number of tweets containing @. The Cumulative Distribution Function (CDF) curve can quantitatively display the distribution of data. Each CDF curve represents the data distribution of a certain feature of a group of samples. Through the CDF curve, we find the differences in the data distribution of statistical characteristics corresponding to multiple sample groups. The cumulative distribution of the average  
Figure 1: Social media bot detection framework. mentions of tweets in the dataset [32] of this paper is shown in Figure 2a. The @ ratio of most social media bots is lower than that of common users, which indicates that social media bots do not have a large number of mentions of other users when they tweet. This is because a large number of @ will cause a poor experience for the tagged accounts, and social media platforms may close such accounts. In order to ensure the long-term validity of the account, social media bots no longer use this method to spread information. On the contrary, real users will have some @ behaviors on the Internet, so this feature can be used as an important indicator to distinguish social media bots from normal users. 2. The average number of emojis used in tweets is \(x_{i2}\); the writing style of social media bots is very different from that of normal users. Bots' tweets are full of emojis or have no facial emojis at all. However, the use of emojis by normal users is not so extreme. This indicator is defined as follows: \[x_{i2}=\frac{Emoji_{i}}{Total_{i}}\] (2)  
\(Emoji_{i}\) is the total number of emojis in tweets. The cumulative distribution of the average number of emojis used in tweets is shown in Figure 2b. The beginning of the two curves shows that the tweets of normal users and social media bots contain fewer emojis, while normal users use a small number. On the contrary, social media bots use the highest number of emojis in 100 tweets, with an average of 68. The average emoji number of normal users is four, so the use of emojis is an important indicator to distinguish social media bots from normal users. 3.