{'fraction_non_alphanumeric': 0.041329830234438154, 'fraction_numerical': 0.010206143896523847, 'mean_word_length': 4.4058630735615445, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
An End-to-End Framework to Identify Pathogenic Social Media Accounts on Twitter

Pathogenic Social Media (PSM) accounts such as terrorist supporter accounts and fake news writers have the capability of spreading disinformation to viral proportions. Early detection of PSM accounts is crucial as they are likely to be key users to make malicious information"viral". In this paper, we adopt the causal inference framework along with graph-based metrics in order to distinguish PSMs from normal users within a short time of their activities. We propose both supervised and semi-supervised approaches without taking the network information and content into account. Results on a real-world dataset from Twitter accentuates the advantage of our proposed frameworks. We show our approach achieves 0.28 improvement in F1 score over existing approaches with the precision of 0.90 and F1 score of 0.63.


I. INTRODUCTION
"Pathogenic Social Media" (PSM) accounts have the capability of spreading disinformation to viral proportions. These accounts including terrorist supporter accounts, water armies, and fake news writers seek to promote or degrade certain ideas through social media in order to reach their goals. In this regard, identifying PSM accounts has found growing important applications to countering extremism [1], [2], detection of water armies [3], [4] and fake news campaigns [5], [2]. In Twitter, many of these accounts are social bots. Early detection of PSM accounts are crucial as they are likely to be the key users to malicious information campaign and detecting them is thus critical to understanding and stopping such campaigns. However, this task is difficult in practice. Existing methods rely on message content [6], network structure [7] or a combination of both [8], [9], [10]. However, the network structure is not always available. For example, the Facebook API does not make this information available without the permission of the users. Moreover, the use of content often necessitates the training of a new model for the previously unobserved topics. For example, PSM accounts taking part in elections in the U.S. and Europe will likely leverage different types of content. To deal with these issues, causal inference is tailored to detect PSM accounts in [11] based on an unsupervised learning method. The authors identified PSM users in the viral cascades, where "viral" is defined as an order-of-magnitude increase. As viral cascades are so rare, users that cause them are suspicious accounts. This work is continued by considering a time-decay causal and proposing a causal community detection-based classification method [12].
In this paper, we expand on the previous work in [11] and propose graph-based metrics to distinguish PSMs from normal users within a short time around their activities. Our new metrics combined with our causal ones can achieve high precision 0.90, while increasing the recall from 0.22 to 0.49. We propose supervised and semi-supervised approaches and then show our proposed methods outperform the ones in the literature. In summary, the major contributions of this paper are itemized as follows: • We propose supervised and semi-supervised PSM detection frameworks that do not leverage network structure, cascade path information, content and user's information.
• We introduce graph-based framework using the cascades and propose a series of scalable metrics to identify PSM users. We apply this framework to more than 722K users and 35K cascades.
• We introduce a self-training semi-supervised framework that can capture more than 29K PSM users with the precision of 0.81. We only used 600 labeled data for training and development sets. Moreover, if a supervisor is involved in the training loop, the proposed algorithm is able to capture more than 80K PSM users. The rest of the paper is organized as follows. In Section II, we describe our framework that leverages causal metrics, graph-based metrics. We present the algorithms in Section III. This is followed by a description of our dataset in Section IV. Then we describe our implementation and discuss our results in Section V. Finally, related work is reviewed in Section VI.

II. TECHNICAL APPROACH A. Technical Preliminaries
Throughout this paper we shall represent cascades as an "action log" (Actions) of tuples where each tuple (u, m, t) ∈ Actions corresponds with a user u ∈ U posting message m ∈ M at time t ∈ T , following the convention of [13], [11]. We assume that set M includes posts/repost of a certain original tweet or message. For a given message, we only consider the first occurrence of each user. We define Actions m as a subset of Actions for a specific message m. Formally, we define it as Actions m = {(u , m , t ) ∈ Actions s.t. m = m}. Note that the users posting tweet/retweet in the early stage of cascades are the most important ones since they play a significant role in advertising the message and making it viral. For a given m ∈ M , we say m-participant i "precedes" mparticipant j if there exists t < t where (i, m, t), (j, m, t ) ∈ Actions. Thus, we define key users as a set of users adopting a message in the early stage of its life span. We formally define key user as follows: Definition 2. (Key User). For a given message m, mparticipant i, and Actions m , we say user i is a key user iff user i precedes at least φ fraction of m-participants (formally: |Actions m | × φ ≤ |{j|∃t : (j, m, t ) ∈ Actions m ∧ t > t}|, (i, m, t) ∈ Actions m ), where φ ∈ (0, 1).
The notation | · | denotes the cardinality of a set. All messages are not equally important. That is, only a small portion of them gets popular. We define viral messages as: Definition 3. (Viral Messages). For a given threshold θ, we say that a message m ∈ M is viral iff |Actions m | ≥ θ. We use M vir to denote the set of viral messages.
The Definition 3 allows us to compute the prior probability of a message (cascade) going viral as follows: We also define the probability of a cascade m going viral given some user i was involved as: We are also concerned with two other measures. First, the probability that two users i and j tweet or retweet viral post m chronologically, and both are key users. In other words, these two users are making post m viral.
|{m ∈ M vir |∃t, t where t < t and (i, m, t), (j, m, t ) ∈ Actions}| |{m ∈ M |∃t, t where t < t and (i, m, t), (j, m, t ) ∈ Actions}| Second, the probability that key user j tweets/retweets viral post m and user i does not tweet/retweet earlier than j. In other words, only user j is making post m viral.
p ¬i,j = |{m ∈ M vir |∃t s.t. (j, m, t ) ∈ Actions and ∃t where t < t , (i, m, t) ∈ Actions}| |{m ∈ M |∃t s.t. (j, m, t ) ∈ Actions and ∃t where t < t , (i, m, t) ∈ Actions}| (4) Knowing the action log, we aim to find a set of pathogenic social media (PSM) accounts. These users are associated with the early stages of large information cascades and, once detected, are often deactivated by a social media firm. In the causal framework, a series of causality-based metrics for identifying PSM users is introduced.

B. Causal Framework
We adopt the causal inference framework previously introduced in [14], [15]. We expand upon that work in two ways [11]: (1.) we adopt it to the problem of identifying PSM accounts and (2.) we extend their single causal metric to a set of metrics. Multiple causality measurements provide a stronger determination of significant causality relationships.
For a given viral cascade, we seek to identify potential users who likely cause the cascade viral. We first require an initial set of criteria for such a causal user. We do this by instantiating the notion of Prima Facie causes to our particular use case below: For a given cascade m, we will often use the language prima facie causal user to describe user i is a prima facie cause for m to be viral. In determining if a given prima facie causal user is causal, we must consider other "related" users. We say i and j are m-related if (1.) i and j are both prima facie causal users for m, (2.) i and j are both key users for m, and (3.) i precedes j. Hence, we will define the set of "related users" for user i (denoted R(i)) as follows: (3) is the probability that cascade m goes viral given both users i and j, and p ¬i,j in (4) is the probability that cascade m goes viral given key user j tweets/retweets it while key user i does not tweet/retweet m or precedes j. The idea is that if p i,j − p ¬i,j > 0, then user i is more likely a cause than j for m to become viral. We measure Kleinberg-Mishra causality ( K&M ) as the average of this quantity to determine how causal a given user i is as follows: Intuitively, K&M measures the degree of causality exhibited by user i. Additionally, we find it useful to include a few other measures. We introduce relative likelihood causality ( rel ) as follows: where ω is infinitesimal. Relative likelihood causality metric assesses the relative difference between p i,j and p ¬i,j . This helps us to find new users that may not be prioritized by K&M . We also find that if a user is mostly appearing after those with the high value of K&M , then it is likely to be a PSM account. One can consider all possible combinations of events to capture this situation. However, this approach is computationally expensive. Therefore, we define Q(j) as: Accordingly, we define neighborhood-based causality ( nb ) as the average K&M (i) for all i ∈ Q(j) as follows: The intuition behind this metric is that accounts who are retweeting a message that was tweeted/retweeted by several causal users are potential for PSM accounts. We also define the weighted neighborhood-based causality ( wnb ) as follows: The intuition behind the metric wnb is that the users in Q may not have the same impact on user j and thus different weights w i are assigned to each user i with K&M (i). In our previous work [11], we provided more details of these metrics.

C. Graph-based Framework
User-Message Bipartite Graph. Here, we denote Actions as a bipartite graph G u−m (U, M, E), where users U and messages M are disjoint sets of vertices. There is an annotated link from user u to message m if u has tweeted/retweeted m and is annotated by occurrence time t (see Fig. 1). In other words, every edge in graph G u−m is associated with one tuple (u, m, t) ∈ Actions. For a given node u ∈ U (m ∈ M ), is the set of immediate neighbors of u (m). We also define U v ⊂ U which is the set of verified users (often celebrities). We indicate U v m = {u|(u, m, t) ∈ Actions, u ∈ U v } as a set of verified users that have re/tweeted message m.
As for the edges, we examine different metrics such as Jaccard similarity between users, and rank of a user in a message which is defined as Rank (u,m) = |{(u , m, t ) ∈ Actions|(u, m, t) ∈ Actions, t < t}|. We also define normalized rank as: Our intuition behind rank metric Rank (u,m) is that the earlier a user has participated in spreading a message, the more important the user is. In this regard, we can also define the exponential decay of the time as: where ∆t m , and γ is a constant. This metric prioritizes based on the retweeting time of the message. In other words, this metric assigns different weights to different time points of a given time interval, inversely proportional to their duration from start of the cascade, i.e., smaller duration is associated with higher weight.
Using all these information, we then annotated users U based on their local and network characteristics such as degree, and PageRank. We also consider function F ∈ {sum, max, min, avg, med, std} to calculate statistics such as minimum, mean, median, maximum, and standard deviation based on their one-hop or two-hops neighbors. For example, for a given user u, mean of re/tweeted message's PageRank of user u proved to be among top predictive metrics according to our experiments. Using these intuitions, we explored the space of variants features and list those we found to be bestperforming in Table II. User Graph. We represent a directed weighted user graph G(V , E ) where the set of nodes V corresponds with key users. There is a link between two users if they are both key users of at least a message. There is a link from i (j) to j (i) if the number of times that "i appears before j and both are key users" is equal to or larger (smaller) than the case when "j appears before i", see Fig. 1. For a given node i, the set N out determined as a variant of co-occurences of the key user pairs: |{m|i, j are key users, ∃t, t where t < t , (i, m, t), (j, m, t ) ∈ Actions}| min(|{m|i is a key user}|, |{m|j is a key user}|) (14) Using CO i,j , we then propose a weighted co-occurrence score for user i as: where abs(·) denotes the absolute value of the input. The differences between ordered joint occurrences δ i,j is also defined as: The list of user graph-based metrics extracted from graph G is shown in Table III. We further calculate the probability of "user j appears after user i" as: The average probability that user i appears before its related users R(i) is also a good indicator for identifying PSM accounts: Incoming co-occurrence score statistics

Triangles Number of triangles
Clustering coefficient We aim to evaluate users from different perspectives and these metrics have shown to be helpful for evaluating users and detecting PSM accounts.

D. Problem Statement
Our goal is to find the potential PSM accounts from the cascades. In the previous section, we discussed causality metrics, and defined diverse set of features using both usermessage bipartite and user graphs where these metrics can discriminate the users of interest. Problem. (Early PSM Account Detection). Given Action log Actions, causality and structural metrics, we wish to identify set of key users that are PSM accounts.

III. PSM ACCOUNT DETECTION ALGORITHM
We employ supervised, and semi-supervised approaches for detecting PSM accounts. Proposed metrics are scalable and can be calculated efficiently using map-reduce programming model and storing data in a graph-based database. To such aim, we used Neo4j to store data and calculated most of the structural metrics using Cypher query language [16].

A. Supervised Learning Approach
We evaluate several supervised learning approaches including logistic regression (LR), naive bayes (NB), k-nearest neighbors (KNN) and random forest (RF) on the same set of features. We also develop a dense deep neural network structure using Keras. As for the deep neural network and in order to find the best architecture and hyperparamters, we utilize the random search method. Many model structures were tested and Fig. 2 illustrates the best architecture.
As we can see from Fig. 2, the proposed deep neural net, in fact, consists of three dense deep neural net structures. The first two structures are of the same, but the activation functions of their layers are different. The intuition is that we aimed to capture the most useful information from the input data and our experiments show the ReLU and Sigmoid activation functions can contribute to this. Specifically, these two structures are aimed to filter the noises in the input data and prepare clean inputs to feed into the third structure. In this regard, the outputs of these two structures along with the input data are concatenated into one vector and this vector is fed into another dense deep neural net. Finally, the output of this structure is fed into a regular output layer. To avoid overfitting, we used dropout method. In the proposed framework, the binary cross entropy loss function is minimized and the best optimizers are reported as Adam and Adagrad.

B. Self-Training Semi-Supervised Learning Approach
Semi-supervised algorithms [8], [17] use unlabeled data along with the labeled data to better capture the shape of the underlying data distribution and generalize better to new samples. Here, we propose a Weighted Self-Training Algorithm (WSET) shown in Algorithm 1 to address such problem. We start with small amount of labeled training data and iteratively add users with high confidence scores from unlabeled data to the training set. Lets denote labeled data L = {u i , l i } and unlabeled data U = {u j }. Labeled data is split to training set L t and development set L d . We then iteratively train a classifier using training set and predict the confidence scores for development set and unlabeled data. Based on the confidence score obtained from development set, a threshold is determined. We then select all samples from unlabaled data that satisfy the threshold. Next, those samples are removed from unlabeled set and are added to the training set. The termination condition is determined based on at most θ tr drop in accuracy on the development set or minimum number of selected users by algorithm.
There are still two main questions that need to be answered: Q1. Should all training samples be weighted equally? Q2. How should a threshold be determined for adding unlabeled data to the labeled set? Since the prediction mistake reinforces itself, and the prediction error increases by number of iterations, the way we choose samples is of importance. According to our experiments, all training samples should not be weighted equally. We found the Algorithm 1 Weighted Self-Training Algorithm (WSET) it = it + 1 16: return L t exponential decay weighting approach as the most efficient one (see Q1). Considering a sample with confidence p l associated to a specific label l in iteration it, the exponential decay weighting approach is defined as: where β is a parameter. To answer the second question, we pick the threshold to have the minimum precision of θ pr on development set in each iteration. Since the precision decreases as the algorithm iterates, the threshold is required to be adjusted in order to make sure the top ranked and qualified samples are picked up. Mathematically, the updated threshold in each iteration is defined as follows: where α is a parameter, α ∈ [0, 1 it−1 ], it > 0. We pick 0.005 for the experiments. If it = 1, the threshold is equal to θ pr . As the number of iteration increases the threshold is updated according to the product of α and iteration number it. This approach can make sure that we are picking samples with acceptable confidence. Algorithm 2 presents our approach for updating labeled and unlabaled datasets.

IV. ISIS DATASET
Our dataset consists of ISIS related tweets/retweets in Arabic gathered from Feb. 2016 to May 2016. This dataset is discussed in details in [11]. The dataset includes tweets and the associated information such as user ID, re-tweet ID, hashtags, number of followers, number of followee, content, date and time. About 53M tweets are collected based on the 290 hashtags such as State of the Islamic-Caliphate, and Islamic State. In this paper, we only use tweets (more than 9M) associated with viral cascades.
return L t , U

Fig. 3: Distribution of cascades vs cascade size
Cascades. We aim to identify PSM accounts. For this dataset, they are mainly social bots or terrorism-supporting accounts that participate in viral cascades. The tweets have been retweeted from 102 to 18,892 times. This leads to more than 35K cascades which are tweeted or retweeted by more than 1M users. The distribution of the number of cascades vs cascade size is illustrated in Fig. 3.
User's Current Status. We select key users that have tweeted or retweeted a post in its early life span -among first half of the users (according to Definition 2, φ = 0.5), and check whether they are active or not. Accounts are not active if they are suspended or deleted. Less than 24% of the users are inactive. Inactive users are representative of automatic and terrorism accounts aiming to disseminate their propaganda and manipulate the statistics of the hashtags of their interest.

V. RESULTS AND DISCUSSION
We implement part of our code in Scala Spark and Python 2.7x and run it on a machine equipped with an Intel Xeon CPU (2 processors of 2.4 GHz) with 256 GB of RAM running Windows 7. We also implement most of structural metrics in Cypher query language. We create the graphs using Neo4j [16] on a machine equipped with an Intel Xeon CPU (2 processors of 2.4 GHz) with 520 GB of RAM. We set the parameter φ as 0.5 to label key users (Definition 2). That is, we are looking for the users that participate in the action before the number of participants gets twice.
In the following sections, first we look at the baseline methods. Then we address the performance of two proposed approaches (see Section III): (1) Supervised Learning Approach: applying different supervised learning methods on proposed metrics, (2) Self-Training Semi-Supervised Learning Approach: selecting users by applying Algorithm 1. The intuition behind this approach is to select users with the high probability of being either PSM or non-PSM (normal user) from unlabeled data and then adding them to the training set in order to improve the performance. We evaluate methods based on both Precision-Recall and Receiver Operating Characteristics (ROC) curves. Note that in all experiments, the training, development, and test sets are imbalanced with more normal users than PSM users. The statistics of the datasets are presented in Table IV. Dataset A is randomly selected from dataset B using sklearn library [18]. Note that, all random selections of data in the experiments have been done using sklearn library. We repeated the experiments 3 times and picked the median output. It is worth to mention that the variance among the results was negligible. In this problem, our goal is to achieve high precision while maximizing the recall. The main reason is labeling an account as PSM means it should be deleted. However, removing a normal user is costly. Therefore, it is important to have a high precision to prevent removing the normal users.

A. Baseline Methods
We have compared our results with existing work for detecting PSM accounts [11], [12] or bots [8].
Causality. This paper presents a set of causality metrics and unsupervised label propagation model to identify PSM accounts [11]. However, since our approach is supervised, we only use the causality metrics and evaluate its performance in a supervised framework. C2DC. This approach uses time decay causal community detection-based classification to detect PSM accounts [12]. We also considered time decay causal metrics with random forest as another baseline method (TDCausality). Sentimetrix. This approach is proposed by the top-ranked team in the DARPA Twitter Bot Challenge [8]. We consider all features that we could extract from our dataset. Our features include tweet syntax (average number of hashtags, average number of user mentions, average number of links, average number of special characters), tweet semantics (LDA topics), and user behaviour (tweet spread, tweet frequency, tweet repeats). The proposed method starts with a small seed set and propagate the labels. As we have enough labeled dataset for the training set, we use random forest as the learning approach.
We use dataset A to evaluate different approaches. Fig. 4a shows the precision-recall curve for these methods. As it is shown, in the supervised framework, Sentimetrix outperforms all approaches in general. Also, Causality is a comparable approach with Sentimetrix with the constraint that the precision is no less than 0.9 as illustrated in Fig. 4b. Note that, most of the features used in the previous bot detection work take advantage of content and network structure of users. However, this is not the case in our proposed metrics and approach.

B. Supervised Learning Approach
In this section, we describe the classification results using proposed metrics with different learning approaches. We used both datasets for this experiment. First, we use the same dataset as we used in baseline experiments (A). Then, we use dataset B for comparing top methods which is 8.5 times larger than dataset A. Fig. 5a shows the ROC curve for different approaches. As it is shown, deep neural network achieved the highest area under the curve. Note that, the deep neural network is comparable with random forest as it is shown in Fig. 5b on Dataset A. The proposed approaches could improve the recall from 0.22 to 0.49 with the precision of 0.9. According to the random forest, top features are from all categories including causality metrics: nb , wnb , user-message graph-based metrics: user's PageRank P R(u), median of retweeted message's PageRank P S u,med , degree D u , mean of verified users in his messages U v S u,mean , T S u,med , T S u,mean , median of length of the cascades CS u,med , user graph-based metrics: weighted cooccurrence score CO w u,Nu . In Fig. 6b, we probe the performance of the top two supervised approaches on larger dataset B. Deep neural network is able to achieve the recall of 0.48 with the precision of 0.9. It is also able to achieve AUC of 0.83 on this dataset (Fig. 6a). It is worth to mention that we assigned higher weights to PSM accounts to deal with data imbalance problem. In this experiment, we randomly select 300 PSM and 300 normal users from dataset B for training and development sets and the rest of the dataset was considered as unlabeled data. We conduct two types of experiments: WSET Algorithm. In this experiment, we evaluate the selftraining semi-supervised approach using Algorithm 1. In this approach, we iteratively update the training set and the termination condition is accuracy of the model on the development set. We set the parameters as θ pr = 1, α = 0.05, θ tr = 0.03. We use a random forest classifier to train the model. The cumulative number of true positive and false positive is shown in Fig. 7a. With using 300 PSM accounts as seed set, WSET can find 29,440 PSM accounts with the precision of 0.81. Note that, we can stop the algorithm earlier.
In this case, precision varies from 0.97 to 0.81. Fig. 7b illustrates cumulative number of selected users as normal users by WSET. As shown, the number of true negatives (selected normal accounts as normal users) is 18,343 with precision of 0.93. Supervised WSET Algorithm. In previous experiment, we assume that the supervisor checks accounts labeled as PSM by WSET at the end. However, this process can be done iteratively. Here, we assume that the supervisor evaluates the PSM labeled accounts by WSET in each iteration and verify if they are either true or false positive. Therefore, these labels along with the non-PSM labeled accounts by WSET are fed into WSET. According to our results, the number of true positive increases to 80,652 with the precision of more than 0.8. That is, using this approach we can increase the number of true positive PSM accounts 2.7 times.

VI. RELATED WORK
In summary, majority of previous work was based on three fundamental assumptions which make them different from our work. First, the information of the network is known [8], [13], [19], [20]. This assumption may not hold in reality. Second, they are language-dependent [8], [6]. Third, the majority of botnet detection algorithms focused on bots in general. That is, they did only consider the bots equally [6], [10] while here, we identify PSM accounts that spread harmful viral information. Identifying PSM accounts. Compared to previous PSM account detection work in [11], [12], we propose graph-based features and unlike the unsupervised learning approach in [11], we expand out both the supervised and semi-supervised learning methods. We also develop a deep neural network and show how our proposed approaches improve them significantly. Identifying Automatic Accounts.
DARPA conducted the Twitter bot detection challenge to identify and eliminate influential bots [8]. Most of the previous work extracted different sets of features (tweet syntax, tweet semantics, temporal behavior, user profile, friends and network features) and conducted supervised or semi-supervised approaches [8], [9], [10]. However, without using content, and network structure, they perform poorly. Also, some of the features such as tweet semantics depend on the language. It is yet a challenge to apply these features to other languages such as Arabic. Analysis of Terrorist Groups and Detection of Water Armies. Terrorist groups use social media for propaganda dissemination [21]. Benigni et al. [19] conducted vertex clustering and classification to find Islamic Jihad Supporting Community on Twitter. Abdokhodair et al. [20] studied the behaviors and characteristics of Syrian social botnet. Chen et al. [3] found that within the context of news report comments, user-specific measurements can distinguish water army from normal users. Our work is different from them since these methods used features related to the accounts and network.

VII. CONCLUSION
In this paper, we conducted a data-driven study on the pathogenic social media accounts. We proposed supervised and semi-supervised frameworks to detect these users. We achieved the precision of 0.9 with F1 score of 0.63 using supervised framework. In semi-supervised framework, we are able to detect more than 29K PSM users by using only 600 labeled data for training and development sets with the precision of 0.81. Our approaches identify these users without using network structure, cascade path information, content and users' information. We believe our technique can be applied in the areas such as detection of water armies and fake news campaigns. Our future plan is to combine the proposed semisupervised approach with unsupervised one in [11] in order to find the initial seed set for the semi-supervised approach.