# An Evolutionary Computation Approach for Twitter Bot Detection
## 3 Data Preparation
### Feature Extraction
Additionally, the frequency of words used to write tweets by a given user \(u\) is calculated as follows:  
\[\text{freq}_{\text{words}}(t_{u})=\frac{\text{count}_{\text{words}}(t_{u})}{|t _{u}|} \tag{3}\]  
In this way, we are describing the mean number of words (tokens that are not hashtags nor mentioned users) for each published tweet, including duplicates. Since this measure should account for the writing behavior of user \(u\), we decide to exclude from the computation of this property the words contained in retweets, which are tweets that have not been written by \(u\) and thus they present a potentially different writing behavior;
* _Statistical measures over raw counts_: set of features derived by applying statistical measures, namely, mean, median, max, min, and standard deviation, to three arrays containing, respectively, the raw counts of the distinct words, hashtags, and mentioned users. Raw counts can be extracted from tokenized published tweets set \(t_{u}\) and tokenized retweets set \(r_{u}\) of a given user \(u\). These measures are computed considering distinct hashtags and mentioned users that appear in both tweets and retweets of user \(u\). We consider distinct words that appear only in published tweets at least three times, and thus when computing these statistical measures on the raw counts of distinct words, we exclude words that appear in retweets of user \(u\). As a matter of fact, these types of measures over raw word counts aim to capture the writing behavior of a given user \(u\). Quite to the contrary, when computing these statistical measures over the raw counts of hashtags and mentioned users, we consider those that are contained in retweets and tweets as well, since it can be arguably verified that a hashtag or a mentioned user that appears in a retweet of user \(u\) gains additional exposure even though the user \(u\) has posted it through a retweet. These measures can be useful because they can estimate, for example, how the frequency of words varies within the sample of tweets collected for the user \(u\). In particular, a low standard deviation of raw word counts is expected if user \(u\) has a uniform behavior when writing posts. In contrast, this value is high if few words are over-used, while many others are less sponsored. For these reasons, these types of measures can help to discriminate between bot profiles and human profiles by analyzing their writing behavior;
* _Reputation_: this feature is computed by analyzing the number of followers of a given user \(u\) compared to the number of followings, or friends, of the same user: \[\text{rep}(u)=\frac{|u.\text{followers}|}{|u.\text{followers}|+|u.\text{ friends}|}\] (4) This property exhibits a high value when the user \(u\) has a large number of followers and a few followings, such as celebrities and politicians. Quite the opposite, bot accounts that usually have a large number of followings and a few followers are likely to exhibit a low reputation value. Figure 4 shows that high reputation values are easily observable in human accounts, while lower reputation values are more likely to belong to bot accounts;* _Growth rate_: a set of features that can be computed by dividing each user metadata numerical property by the number of years of activity of a given user \(u\) on the Twitter platform. In particular, each growth rate is computed as follows: \[\text{growth}_{c}(u)=\frac{|u.c|}{u.\text{current\_activity\_years}}\] (5) where \(c\in\{\text{followers, friends, favourites, listed, statuses}\}\). Therefore, we describe the mean number of followers, followings, favorites, lists, and tweets, that a given user \(u\) gains or produces in a year of activity on Twitter;
* _Tweets similarity_: a feature that measures the mean similarity computed between each pair of distinct published tweets contained in the tokenized tweets sample \(t_{u}\) for a given user \(u\).