{'fraction_non_alphanumeric': 0.029686067465461097, 'fraction_numerical': 0.012772280357876767, 'mean_word_length': 5.120743034055727, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Predicting online extremism, content adopters, and interaction reciprocity

We present a machine learning framework that leverages a mixture of metadata, network, and temporal features to detect extremist users, and predict content adopters and interaction reciprocity in social media. We exploit a unique dataset containing millions of tweets generated by more than 25 thousand users who have been manually identified, reported, and suspended by Twitter due to their involvement with extremist campaigns. We also leverage millions of tweets generated by a random sample of 25 thousand regular users who were exposed to, or consumed, extremist content. We carry out three forecasting tasks, (i) to detect extremist users, (ii) to estimate whether regular users will adopt extremist content, and finally (iii) to predict whether users will reciprocate contacts initiated by extremists. All forecasting tasks are set up in two scenarios: a post hoc (time independent) prediction task on aggregated data, and a simulated real-time prediction task. The performance of our framework is extremely promising, yielding in the different forecasting scenarios up to 93% AUC for extremist user detection, up to 80% AUC for content adoption prediction, and finally up to 72% AUC for interaction reciprocity forecasting. We conclude by providing a thorough feature analysis that helps determine which are the emerging signals that provide predictive power in different scenarios.


Introduction
Researchers are devoting increasing attention to the issues related to online extremism, terrorist propaganda and radicalization campaigns [1], [2]. Social media play a central role in these endeavors, as increasing evidence from social science research suggests [3], [4]. For example, a widespread consensus on the relationship between social media usage and the rise of extremist groups like the Islamic State of Iraq and al-Sham (viz. ISIS) has emerged among policymakers and security experts [5], [6], [7]. ISIS' success in increasing its roster to thousands of members has been related in part to a savvy use of social media for propaganda and recruitment purposes. One reason is that, until recently, social media platform like Twitter provided a public venue where single individuals, interest groups, or organizations, were given the ability to carry out extremist discussions and terrorist recruitment, without any form of restrictions, and with the possibility of gathering audiences of potentially millions. Only recently, some mechanisms have been put into place, based on manual reporting, to limit these abusive forms of communications. Based on this evidence, we argue in favor of developing computational tools capable of effectively analyzing massive social data streams, to detect extremist users, to predict who will become involved in interactions with radicalized users, and finally to determine who is likely to consume extremist content. The goal of this article is to address the three questions above by proposing a computational framework for detection and prediction of extremism in social media. We tapped into Twitter to obtain a relevant dataset, leveraged expert crowd-sourcing for annotation purposes, and then designed, trained and tested the performance of our prediction system in static and simulated real-time forecasts, as detailed below.

Contributions of this work
The main contributions of our work can be summarized as: • We formalize three different forecasting tasks related to online extremism, namely the detection of extremist users, the prediction of adoption of extremist content, and the forecasting of interaction reciprocity between regular users and extremists. • We propose a machine prediction framework that analyzes social media data and generates features across multiple dimensions, including user metadata, network statistics, and temporal patterns of activity, to perform the three forecasting tasks above. • We leverage an unprecedented dataset that contains over 3 millions tweets generated by over 25 thousand extremist accounts, who have been manually identified, reported, and suspended by Twitter. We also use around 30 million tweets generated by a random sample of 25 thousand regular users who were exposed to, or consumed, extremist content. • For each forecasting task, we design two variants: a post-hoc (time independent) prediction task performed on aggregated data, and a simulated real-time forecast where the learning models are trained as if data were available up to a certain point in time, and the system must generate predictions on the future. • We conclude our analysis by studying the predictive power of the different features employed for prediction, to determine their role in the three forecasts.

Data and Preliminary Analysis
In this section we describe our dataset, the curation strategy yielding the annotations, and some preliminary analysis.

Sample selection and curation
In this work we rely on data and labels constructed by using a procedure of manual curation and expert verification. We retrieved on a public Website a list of over 25 thousands Twitter accounts whose activity was labeled as supportive of the Islamic State by the crowd-sourcing initiative called Lucky Troll Club. The goal of this project was to leverage annotators with expertise in Arabic languages to identify ISIS accounts and report them to Twitter. Twitter's antiabuse team manually verifies all suspension requests, and grants some based on the active violation of Twitter's Terms of Service policy against terrorist-or extremist-related activity. Here we focus on the 25,538 accounts that have been all suspended between January and June 2015 by Twitter as a consequence of evidence of activity supporting the Islamic State group. For each account, we also have at our disposal information about the suspension date, and the number of followers of that user as of the suspension date.

Twitter data collection
The next step of our study consisted in collecting data related to the activity of the 25,538 ISIS supporters on Twitter. To this purpose, we leveraged the Twitter gardenhose data source (roughly 10% of the Twitter stream) collected by Indiana University [8]. We decided to collect not only the tweets generated by these accounts prior to their suspension, but also to build a dataset of their targets. In particular, we are concerned with accounts unrelated to ISIS with whom the ISIS supporters tried to establish some forms of interaction. We therefore constructed the following two datasets: ISIS accounts: this dataset contains 3,395,901 tweets generated in the time interval January-June 2015 by the 25,538 accounts identified by Twitter as supporters of ISIS. This is a significant portion of all the accounts suspended by Twitter in relation to ISIS. 1 Users exposed to ISIS: this dataset contains 29,193,267 tweets generated during January-June 2015 by a set of 25 thousand users randomly sampled among the larger set of users that constitute ISIS accounts' followers. This set is by choice of equal size to the former one, to avoid introducing class imbalance issues.
For prediction purposes, we will use as positive and negative labels the ISIS accounts group and the accounts in the users exposed to ISIS, respectively. 1. The Guardian recently reported that between April 2015 and February 2016, Twitter's anti-terror task force suspended about 125,000 accounts linked to ISIS extremists: http://www.theguardian.com/technology/2016/ feb/05/twitter-deletes-isis-accounts-terrorism-online

Methodology
In this section we discuss the learning models and the features adopted by our framework. The complete prediction pipeline (learning models, cross validation, feature selection, and performance evaluation) is developed using Python and the scikit-learn library [9].

Learning models
We adopt two off-the-shelf learning models as a proof of concept for the three classification tasks that we will discuss later (see §4): Logistic Regression and Random Forests. Logistic Regression: The first implemented algorithm is a simple Logistic Regression (LR) with LASSO regularization. The advantage of this approach is its scalability, which makes it very effective to (possibly real-time) classification tasks on large datasets. The only parameter to tune is the loss function C. We expect that LR will provide the baseline classification and prediction performance. Random Forests: We also use a state-of-the-art implementation of Random Forests (RF) [10]. The vectors fed into the learning models represent each user's features. Random Forests are trained using 100 estimators and adopting the Gini coefficient to measure the quality of splits. Optimal parameters setting is obtained via cross validation (see 3.1.1).
Note that the goal of this work is not to provide new machine learning techniques, but to illustrate that existing methods can provide promising results. We also explored additional learning models (e.g., SVM, Stochastic Gradient Descent, etc.), which provide comparable prediction performance but are less computationally efficient and scalable.
3.1.1. Cross validation. The results of our performance evaluation (see §4) are all obtained via k-fold cross validation. We adopt k = 5 folds, and therefore use 80% of data for training, and the remainder 20% for testing purpose, averaging performance scores across the 5 folds. We also use 5-fold cross validation to optimize the parameters of the two learning algorithms (LR and RF), by means of an exhaustive cross-validated grid search on the hyperparameter space.

Evaluation scores.
We benchmark the performance of our system by using four standard prediction quality measures, namely Precision, Recall, F1 (harmonic mean of Precision and Recall), and AUC-short for Area Under the Receiver Operating Characteristic (ROC) curve [11].

Feature engineering and feature selection
We manually crafted a set of 52 features belonging to three different classes: user metadata, timing features, and network statistics, as detailed below. User metadata and activity features: User metadata have been proved pivotal to model classes of users in social media [12], [13]. We build user-based features leveraging the metadata provided by the Twitter API related to the author of each tweet, as well as the source of each retweet. User features include the number of tweets, followers and friends associated to each users, the frequency of adoption of hashtags, mentions, and URLs, and finally some profile descriptors. In total, 18 user metadata and activity features are computed (cf. Table 1).
Timing features: Important insights may be concealed by the temporal dimension of content production and consumption, as illustrated by recent work [14], [15]. A basic timing feature is the average number of tweets posted per day. Other timing features include statistics (average, standard deviation, minimum, maximum) of the intervals between two consecutive events, e.g., two tweets, retweets, or mentions. Our framework generates 14 timing features (cf. Table 1). Network statistics: Twitter content spreads from person to person via retweets and mentions. We expect that the emerging network structure carries important information to characterize different types of communication. Prior work shows that using network features significantly helps prediction tasks like social bot detection [8], [13], [15], and campaign detection [16], [17]. Our framework focuses on two types of networks: (i) retweet, and (ii) mention networks. Users are nodes of such networks, and retweets or mentions are directed links between pairs of users. For each user, our framework computes the distribution of followers and friends of all users who retweet and mention that user, and extracts some descriptive statistics (average, standard deviation, minimum, maximum) of these distributions. Our system builds 20 network statistics features (cf. Table 1).

Greedy feature selection.
Our framework generates a set F of |F | = 52 features. In our type of prediction tasks, some features exhibit more predictive power than others: temporal dependencies introduce strong correlations among some features, thus some possible redundancy. Among the different existing ways to select the most relevant features for the prediction task at hand [18], in the interest of computational efficiency, we adopted a simple greedy forward feature selection method, as follows: (i) initialize the set of selected features S = ∅; (ii) for each feature f ∈ F − S, consider the union set U = S ∪ f ; (iii) train the classifier using the features in U ; (iv) test the average performance of the classifier trained on this set; (v) add to S the feature that provides the best performance; (vi) repeat (ii)-(v) as long as a significant performance increase is yield.

Experiments
In the following, we formalize three different prediction problems related to online extremism: Task I (T1): Detection of extremist supporters. The first task that our system will face is a binary classification aimed to detect ISIS accounts and separate them from those of regular users. The problem is to test whether any predictive signal is present in the set of features we designed to characterize social media activity related to extremism, and serves as a yardstick for the next two more complex problems.
Task II (T2): Predicting extremist content adoption. The set of 25 thousand users we randomly sampled among followers of ISIS accounts can be leveraged to perform the prediction of extremist content adoption. We define as a positive instance of adoption in this context when a regular user retweets some content s/he is exposed to that is generated by an ISIS account.
Task III (T3): Predicting interactions with extremists. The third task presents likely the most difficult challenge: predicting whether a regular user will engage into interactions with extremists. A positive instance of interaction is represented by a regular user replying to a contact initiated by an ISIS account.
Static versus real-time predictions. For each of the three prediction tasks described above, we identified two modalities, namely a static (time independent) and a simulated realtime prediction. In the former scenario, a static prediction ignores temporal dependencies in that the system aggregates all data available across the entire time range (January-June 2015), and then performs training and testing using the 5-fold cross validation strategy by randomly splitting datapoints into the 5 folds and averaging the prediction performance across folds. In the latter scenario, a realtime prediction is simulated in which data are processed for training and testing purposes by respecting the timeline of content availability: for example, the system can exploit the first month of available data (January 2015) for training, and then producing predictions for the remainder 5 months (Feb-Jun 2015), for which performance is tested.
The performance of our framework in the three tasks, each with the two prediction modalities, is discussed in the following. The section concludes with the analysis of feature predictive power (see §4.4).

T1: Detection of extremist supporters
In the following we discuss the static (T1A) and realtime (T1B) scenarios for the first prediction task, namely detecting extremist accounts on Twitter.
4.1.1. T1A: Time-independent detection. The detection of extremist user accounts is the most natural task to start the performance evaluation of our framework. Our analysis aims at verifying that the 52 features we carefully handcrafted indeed carry some predictive signal useful to separate extremist users from regular ones. The dataset at hand contains two roughly equal-sized classes (about 25 thousand instances each), where ISIS accounts are labeled as positive instances, and regular users as negative ones. Each instance is a characterized by a 52-dimensional vector, and positive and negative examples are fed to the two learning models (LR and RF). The first task, in short T1A, is agnostic of time dependencies: data are aggregated throughout the entire 6 months period (January-June 2015) and training/testing is performed in a traditional 5-fold cross-validated fashion (cf. §3.1.1). Table 2 summarizes the performance of LR and RF according to the four quality measures described above (cf. 3.1.2): Both models perform well, with Random Forests achieving an accuracy above 87% as measured by AUC. These results are encouraging and demonstrate that simple off-the-shelf models can yield good performance in T1A.  [17]: therefore we expect that the performance of our framework in a simulated real-time prediction task will exceed that of the static scenario. In this simulated real-time prediction task, T1B, we divide the available data into temporal slices used separately for training and prediction purposes. Table 3 reports five columns, each of which defines a scenario where one or more months of data are aggregated for training, and the rest is used for prediction and performance evaluation. For example, in the first column, the learning models are trained on data from January 2015, and the prediction are performed and evaluated on future data in the interval February-June 2015.
Random Forests greatly benefits from accounting for temporal dependencies in the data, and the prediction performance as measured by AUC ranges between 83.8% (with just one month of training data) to an excellent 93.2% (with five months of training data). Fig. 1(left) illustrates the ranking of the top 11 features identified by feature selection, as a function of the number of months of data in the training set. Fig. 1(right) displays the distributions of the rankings of each feature across the 5 different temporal slices. For the extremist users detection task, the most predictive features are (1) number of tweets, (2) average number of hashtags, and (3) average number of retweets. One hypothesis is that extremist users are more active than average users, and therefore exhibit distinctive patterns related to volume and frequency of activity.

T2: Predicting extremist content adoption
The second task, namely predicting the adoption of extremist content by regular users, is discussed in the static (T2A) and real-time (T2B) scenarios in the following.
4.2.1. T2A: Time-independent prediction. The first instance of T2 is again on the time-aggregated datasets spanning January-June 2015. Predicting content adoption is a known challenging task, and a wealth of literature has explored the factors behind online information contagion [19]. In this scenario, we aim to predict whether a regular user will retweet a content produced by an ISIS account. Positive instances are represented by users who retweeted at least one ISIS tweet in the aggregated time period, while negative ones are all users exposed to such tweets who did not retweet any of them. Table 4 summarizes the performance of our models: Random Forests emerges again as the best performer, although the gap with Logistic Regression is narrow, and the latter provides significantly better Recall.
Overall, T2A appears clearly more challenging than T1A, as the top performance yields a 77.1% AUC score. The results on the static prediction are promising and set a good baseline for the real-time prediction scenario, discussed next. We again consider temporal data dependencies to simulate a real-time prediction for T2. Similarly to T1B, in T2B we preserve the temporal ordering of data, and divide the dataset in training and testing according to month-long temporal slices, as summarized by Table 5. Random Forests again seems to benefit from the temporal correlations in the data, and the prediction performance at peak improves up to 80.2% AUC. Logistic Regression fails again at exploiting temporal information, showing some performance deterioration if compared to T2A. Fig. 2 shows that, for the content adoption prediction, the ranking of the top 11 features in T2B is less stable than that of T1B. The top three most predictive features for this task are (1) ratio of retweets over tweets, (2) number of tweets, and (3) average number of retweets. Note that the latter two top features also appear in the top 3 of the previous task, suggesting an emerging pattern of feature predictive dynamics.

T3: Predicting interactions with extremists
Our third and last task, namely the prediction of interactions between regular users and extremists, is discussed in the following, again separately for the static (T3A) and real-time (T3B) scenarios. We expect the interaction prediction task to be the most challenging among the three tasks we proposed. Similarly to content adoption prediction, recent literature has explored the daunting challenge of predicting interaction reciprocity and intensity in social media [20]. Consistently with the prior two tasks, our first approach to interaction prediction is time agnostic: we plan to test whether our system is capable to predict whether a regular user who is mentioned by an extremist account will reply back or not. In this case, positive instances are represented by users who reply to at least one contact initiated by ISIS in the aggregated time period (January-June 2015), whereas negative instances are those regular users who did not reply to any ISIS contact. Table 6 reports the prediction performance of our two models: overall, the task proves challenging as expected, being Random Forests the best performer, yielding excellent Recall and 69.2% AUC.
Logistic Regression provides fair performance with a 65.8% AUC score, and both Precision and Recall around 69%. The final task discussed in this paper is the interaction prediction with temporal data. Given the complexity of this problem, as demonstrated by T3A, we plan to test whether incorporating the temporal dimension will help our models achieve better performance. Table 7 shows that this appears to be the case: Random Forests exhibits an improved temporal prediction performance, boasting up to 72.6% AUC, using the first 5 months of data for traning, and the last month for

Feature predictive-power analysis
We conclude our analysis by discussing the predictive power of the features adopted by our framework. First, the choice to focus on the top 11 features, rather than the more traditional top 10, is justified by the occurrence of two ex aequo in the final ranking of top features, displayed in Table 8. Here, we report the ranking of the top 11 features in the three tasks above. Feature selection is performed on the realtime prediction tasks (not on the time-aggregated ones). This analysis captures the essence of the predictive value of our hand-crafted features in the context of real-time predictions. A clear pattern emerges: (1) ratio of retweets over tweets, (2) average number of hashtags, (2 ex-aequo) number of tweets, and (4) average number of retweets, consistently ranked in the top features for the three different prediction tasks. This insight is encouraging: all these features can be easily computed from the metadata reported by the Twitter API, and therefore could be potentially implemented in a real-time detection and prediction system operating on the Twitter stream with unparalleled efficiency.

Related Literature
Two relevant research trends recently emerged in the computational social sciences and in the computer science communities, discussed separately in the following. Computational social sciences research. This research line is concerned more with understanding the social phenomena revolving around extremist propaganda using online data as a proxy to study individual and group behaviors. Various recent studies focus on English-and Arabic-speaking audiences online to study the effect of ISIS' propaganda and radicalization. One example of the former is the work by Berger and collaborators that provided quantitative evidence of ISIS' use of social media for propaganda. In a 2015 study [21], the authors characterized the Twitter population of ISIS supporters, quantifying its size, provenance, and organization. They argued that most of ISIS' success on Twitter is due to a restricted number of highly-active accounts (500-1000 users). Our analysis illustrates that indeed a limited number of ISIS accounts achieved a very high visibility and followership. Berger's subsequent work [22] however suggested that ISIS' reach (at least among English speakers) has stalled for months as of the beginning of 2016, due to more aggressive account suspension policies enacted by Twitter. Again, a limited amount of English accounts sympathetic to ISIS was found (less than one thousand), and these users were mostly interacting with each other, while being only marginally successful at acquiring other users' attention. This analysis suggests a mechanism of diminishing returns for extremist social media propaganda.
Using Twitter data as a historical archive, some researchers [23] recently tried to unveil the roots of support for ISIS among the Arabic-speaking population. Their analysis seems to suggest that supporters of the extremist group have been discussing about Arab Spring uprisings in the past significantly more than those who oppose ISIS on Twitter. Although their method to separate ISIS supporters from opposers is simplistic, the findings relating narrative framing and recruitment mechanisms are compatible with the literature on social protest phenomena [24], [25], [26].
A few studies explored alternative data sources: one interesting example is the work by Vergani and Bliuc [27] that uses sentiment analysis (Linguistic Inquiry and Word Count [28]) to investigate how language evolved across the first 11 Issues of Dabiq, the flagship ISIS propaganda magazine. Their analysis offers some insights about ISIS radicalization motives, emotions and concerns. For example, the authors found that ISIS has become increasingly concerned with females, reflecting their need to attract women to create their utopia society, not revolving around warriors but around families. ISIS also seems to have increased the use of internet jargon, possibly to connect with the identities of young individuals online. Computer science research. This research stream concerns more with the machine learning and data aspects, to model, detect, and/or predict social phenomena such as extremism or radicalization often with newly-developed techniques.
One of the first computational frameworks, proposed by Bermingham et al. [29] in 2009, combined social network analysis with sentiment detection tools to study the agenda of a radical YouTube group: the authors examined the topics discussed within the group and their polarity, to model individuals' behavior and spot signs of extremism and intolerance, seemingly more prominent among female users. The detection of extremist content (on the Web) was also the focus of a 2010 work by Qi et al. [30]. The authors applied hierarchical clustering to extremist Web pages to divide them into different categories (religious, politics, etc.).
Scanlon and Gerber proposed the first method to detect cyber-recruitment efforts in 2014 [31]. They exploited data retrieved from the Dark Web Portal Project [32], a repository of posts compiled from 28 different online fora on extremist religious discussions (e.g., Jihadist) translated from Arabic to English. After annotating a sample of posts as recruitment efforts or not, the authors use Bayesian criteria and a set of textual features to classify the rest of the corpus, obtaining good accuracy, and highlighted the most predictive terms.
Along the same trend, Agarwal and Sureka proposed different machine learning strategies [33], [34], [35], [36] aimed at detecting radicalization efforts, cyber recruitment, hate promotion, and extremist support in a variety of online platforms, including YouTube, Twitter and Tumblr. Their frameworks leverage features of contents and metadata, and combinations of crawling and unsupervised clustering methods, to study the online activity of Jihadist groups on the platforms mentioned above.
Concluding, two very recent articles [37], [38] explore the activity of ISIS on social media. The former [37] focuses on Twitter and aims at detecting users who exhibit signals of behavioral change in line with radicalization: the authors suggest that out of 154K users only about 700 show significant signs of possible radicalization, and that may be due to social homophily rather than the mere exposure to propaganda content. The latter study [38] explores a set of 196 pro-ISIS aggregates operating on VKontakte (the most popular Russian online social network) and involving about 100K users, to study the dynamics of survival of such groups online: the authors suggest that the development of large and potentially influential pro-ISIS groups can be hindered by targeting and shutting down smaller ones. For additional pointers we refer the interested reader to two recent literature reviews on this topic [39], [40].

Conclusions
In this article we presented the problem of predicting online extremism in social media. We defined three machine learning tasks, namely the detection of extremist users, the prediction of extremist content adoption, and the forecasting of interactions between extremist users and regular users. We tapped into the power of a crowd-sourcing project that aimed at manually identifying and reporting suspicious or abusive activity related to ISIS radicalization and propaganda agenda, and collected annotations to build a groundtruth of over 25 thousand suspended Twitter accounts. We extracted over three million tweets related to the activity of these accounts in the period of time between January and June 2015. We also randomly identified an equal-sized set of regular users exposed to the extremist content generated by the ISIS accounts, and collected almost 30 million tweets generated by the regular users in the same period of time.
By means of state-of-the-art learning models we managed to accomplish predictions in two types of scenarios, a static one that ignores temporal dependencies, and a simulated real-time case in which data are processed for training and testing by respecting the timeline of content availability. The two learning models, and the set of 52 features that we carefully crafted, proved very effective in all of the six combinations of forecasts (three prediction tasks each with two prediction modalities, static and real-time). The best performance in terms of AUC ranges between 72% and 93%, depending on the complexity of the considered task and the amount of training data available to the system. We concluded our analysis by investigating the predictive power of different features. We focused on the top 11 most significant features, and we discovered that some of them, such as the ratio of retweets to tweets, the average number of hashtags adopted, the sheer number of tweets, and the average number of retweets generated by each user, systematically rank very high in terms of predictive power. Our insights shed light on the dynamics of extremist content production as well as some of the network and timing patterns that emerge in this type of online conversation.
Our work is far from concluded: for the future, we plan to identify more realistic and complex prediction tasks, to analyze the network and temporal dynamics of extremist discussion, and to deploy a prototype system that allows for real-time detection of signatures of abuse on social media.