Infectivity enhances prediction of viral cascades in Twitter

Models of contagion dynamics, originally developed for infectious diseases, have proven relevant to the study of information, news, and political opinions in online social systems. Modelling diffusion processes and predicting viral information cascades are important problems in network science. Yet, many studies of information cascades neglect the variation in infectivity across different pieces of information. Here, we employ early-time observations of online cascades to estimate the infectivity of distinct pieces of information. Using simulations and data from real-world Twitter retweets, we demonstrate that these estimated infectivities can be used to improve predictions about the virality of an information cascade. Developing our simulations to mimic the real-world data, we consider the effect of the limited effective time for transmission of a cascade and demonstrate that a simple model of slow but non-negligible decay of the infectivity captures the essential properties of retweet distributions. These results demonstrate the interplay between the intrinsic infectivity of a tweet and the complex network environment within which it diffuses, strongly influencing the likelihood of becoming a viral cascade.

Massive data sets that comprehensively capture users' behaviours in online social systems and their underlying network structures have reached an unprecedented scale, making it possible to develop computational methods to model complex patterns of human behaviour at both individual and population levels [1][2][3].Among various humaninduced online processes, the study of social contagion-the spread of information, ideas, and behaviours through social networks-has attracted tremendous attention, especially in the fields of computational social science and network science [4,5].Many studies examine these peer-to-peer diffusion processes by focusing on a single piece of information and making assumptions about infectivity, recovery probabilities, and their intrinsic relations to network structures [6][7][8][9][10].We consider measuring the infectivity of information cascades to be the crux for predicting their ultimate virality.
Previous research has successfully advanced the modelling of information spread by studying memes in Twitter data, where a meme is defined by the use of a hashtag and includes all of the tweets with that hashtag [11][12][13][14][15]. Here, we reanalyze these data with an exclusive focus on modelling the direct transmission of information through a social network in the form of retweets.Our reason for focusing on retweets is that the transmission of a particular hashtag is more likely to occur not only from person to person through online social ties [14], but also through a broadcasting manner across other media outside the specific social network.As observed in Ref. 16, broadcasts contribute substantively to viral events, e.g., the World Cup Final attracts about 1 billion viewers worldwide, while news coverage from popular websites also reaches a similar number of Internet users.In such popular events, the discussion of a meme in broadcasting media (e.g.social network platforms, TV shows, radio and news reports) can greatly boost its spread.Retweets, by contrast, constitute an information cascade that originated from an identifiable individual user and is a contagion spread mostly through the links of the follower network (Fig. 1).
The Twitter data we use contains a follower network with 6.0 × 10 5 users, 1.7 × 10 6 retweets and 1.2 × 10 7 tweets generated by these users in 33 days [12,14].We estimate the probability distribution of the infectivity of cascades from real data, and simulate the process on the follower network (see Methods).A cascade consists of retweets that have the same hashtag and the same user who initially posted the tweet, together with the tweet that originated the cascade.
Previous studies have demonstrated that the topology of networks, especially the community structure, has pronounced effects on information diffusion [12,17].Communities could promote spread by homophily and social reinforcement, but may also hinder wider spread by trapping information, resulting in a high concentration of retweets within a community.To examine the influence of community structures, Weng et al. [12] introduced two statistical features of memes, which we modify for retweet cascades: the adoption dominance g computes the proportion of users retweeting the cascade in the community with the most adopters; and the retweet entropy H r quantifies the distribution of retweets across different communities, as a measure of the concentration of the cascade across communities.

@User
FIG. 1: Schematic of social contagion information diffusion in Twitter.(a) The Twitter user interface that displays three latest tweets with different degrees of interestingness from her friends.The first message was originally posted by someone with whom she does not have direct connection, but she is still able to see it after being retweeted by one of her friends.She chose to retweet the second tweet she found interesting, extending the information flow of that message to all her followers.If the "memory length" of this user is 3, she will not read or retweet messages posted more that 10 hours ago (the time of the third item in the display).(b), The online network environment of involved users and the flows of information cascades.
We compute both measures based only on retweets in their early stages (first 50 tweets) to avoid bias from a cascade's popularity.
Retweet cascades are very different from hashtag memes in that we can more realistically assume that social contagion through the follower network is the major mechanism by which the retweet cascade is propagating.To provide direct evidence of this, we sampled 10 5 tweets and retweets, respectively, finding that for 23.8% of tweets we can find at least one earlier tweet with the same hashtag from the user's friends, while 46.0% of retweets have at least one friend who previously retweeted in the same cascade.Importantly, these percentages are limited by the specific follower network available in the data set, which inherently undercounts the possibility of transmission through the online social network because the network in the data only includes the reciprocal following ties (to better reflect real social relations).We estimate the infectivity of a specific cascade assuming that all such identifications are the actual paths of information transmission, using only the first 50 retweets (see Methods).Despite the relatively high inaccuracies observed between the true and predicted infectivities in our simulated data (where we know the true imposed infectivity, cf.real Twitter data), we note the overall trends of the infectivity estimates are in the right direction, with a slope of 0.92 and R 2 = 0.05 (Fig. 2).We thus proceed to consider predictive models for virality that include such estimates of cascade infectivity.
We now test whether this simple model of infectivity demonstrates predictive power for identifying viral retweet cascades in real Twitter data.In Ref. 12, Weng et al. used community concentration features to predict viral memes with three models: the random guess (RG) model randomly samples the cascade without any predictors; the null model (NM, referred to as the "community-blind model" in Ref. 12) employs the number of distinct users and the total number of neighbours of early retweet users; the community-based (CB) model also incorporates three communitybased features of the Twitter network: the number of infected communities, retweet entropy H r , and the fraction of intra-community user interactions (see Appendix F).We introduce two additional models adding features to the NM model to predict viral cascades with infectivity estimates: the infectivity-based (IB) model uses the estimated rate of infectivity λ0 from equation (2), where k is the mean degree of early retweet users; and the community & infectivity based (C&I) model combines all of these infectivity and community-based features.Each of our classifiers includes only information about the first 50 retweets of each tweet, to try to predict whether the retweet cascade "goes viral".We train random forest classifiers on 1, 272 real Twitter cascades and 20, 000 simulated cascades sampled 0.01 0.02 0.03 0.04 0.005 0.010 0.015 Comparison between real and estimated infectivity in simulations.Real infectivity λ0 and estimated infectivity λ0 computed from simulation data according to equation 2 without considering the decay effects.The solid line is the linear regression fit.Estimates are calculated from only the first 50 retweets of each tweet, so that they may be used to try to predict whether a given cascade "goes viral."from 20 replications, using 10-fold cross validation to predict viral cascades that attract more retweets than a certain percentile threshold θ of all cascades.
The results on the Twitter data suggest that in most cases our IB model performs better than the CB model (Fig. 3ab), indicating that estimated infectivity alone can improve the prediction even more than the communitybased predictors.Moreover, the C&I model, incorporating both community and infectivity factors, reveals a striking increase of predictive power above the other models.Fig. 3cd shows random forest model prediction and recall rates on retweet data generated by our simulations, indicating patterns consistent with those observed in the Twitter data.The IB model, only adding infectivity to the NM model, is comparable to the CB model that includes three community features, and by considering all predictors the C&I model excels in both precision and recall rates.We note that replacing the estimated λ0 by the true λ 0 used in the simulations-a test we can obviously not reproduce in the real Twitter data-yields additional improvement in classification (Table II), suggesting substantial potential for a more refined estimate of λ0 to lead to even greater accuracy for predicting viral cascades.
We further test our results using logistic regression with the same set of features as in the C&I model.We find that estimated infectivity is still a significant predictor in simulation data, but not in predicting virality in the real Twitter data (Tables ??).There may be multiple reasons for this apparent discrepancy between the random forest and logistic regression results.One possibility is that logistic regression is too specific in the functional form in which it estimates the probability of virality.In particular, we note the substantial noise in estimating infectivity we observe in our simulations; without any way to compare the estimated infectivities with "true" values in the real Twitter data, we cannot know whether the effect of this noise interacts poorly with the log-odds-shift assumptions of logistic regression.
Our simulations emulate the real-world diffusion process in Twitter by taking into consideration several human behavioural factors, such as a limited memory length and a gradual decrease in interest, in a simplified simulation model.We estimate a fixed memory length for all users from data and additionally incorporate a small but non-zero decay parameter to the infectivity of each cascade (see Methods).The initial infectivities of cascades are sampled from a probability distribution computed from empirical data (Fig. 4a).The decay effect mainly affects the long time dynamics of viral cascades (Fig. 4b).If we ignore the decay effect of infectivity, cascades with large infectivity will still keep spreading after long periods of time, even with fixed user memory length.With a small but non-zero decay parameter α, even the most popular cascades will diminish at some point, and the system quickly reaches equilibrium.We then use simulations on networks with different structural properties but otherwise identical parameter settings to calculate the distributions of cascade sizes.Fig. 4c shows that our simulations on the Twitter follower network replicate well the cascade distribution observed in the data.We also run a simulation on a configuration model network with the same degree distribution as the empirical Twitter network (Fig. 4d).Simulation results on a synthetic network generated by the algorithm in Ref. 18 with the power-law exponent γ = 2.8, representing an analogous degree heterogeneity of the Twitter network (see Figure 7), also recover the statistical features of Twitter data (Fig. 4e).When we switch the decay parameter to 0.001 and 0.02, respectively, we still replicate the empirical retweet distribution fairly well by changing the corresponding λ max parameter (Appendix E).
We have demonstrated the predictive power of infectivity for identifying viral retweet cascades in real-world Twitter data and in simulation.An important assumption of this study is that the spread of retweet cascades resembles the peer-to-peer social contagion through the Twitter follower network, which we argue is different from viral memes represented by hashtags that more heavily rely on transmission through broadcasting.We demonstrate that the early spread rate for retweet cascades can be a good indicator of the intrinsic interestingness of a tweet, and that the corresponding estimate of infectivity gives improved prediction of virality.But, importantly, the same scheme might not readily apply to some memes that need to be broadly broadcast before they become viral.This difference may help explain why the measure of early infectivity of a hashtag in Ref. 14 does little to improve the prediction of viral memes.
Our mean-field method to estimate infectivity from empirical data clearly leaves plenty of room for improvement.The predictive ability of machine learning methods improves further on simulation data when we include the true infectivity, demonstrating the importance of accurate estimations of the cascade infectivity.Apart from this indirect approach with strong assumptions, we could also design a more straightforward method.The biggest challenge for such a measurement is to gather large-scale, high-quality data with which it is possible to infer accurate retweet relations.Better data and more reliable methodology to estimate infectivity are key to improving the predictive power.
Our study shows that infectivity improves the prediction of viral cascades that are mostly induced by contagion along the links representing social network connections.Network community structure captures additional local environmental factors such as homophily, social reinforcement and a trapping effect that further affect the spread and likelihood of virality of retweet cascades.Nevertheless, the infectivity determines the internal attractiveness and seems to be one of the most important factors in driving the virality of a cascade.Said another way, we have successfully demonstrated that the inherent quality of content-in the sense of being sufficiently interesting to have high infectivity-is an essential element promoting the chances of a successful spread that might not otherwise be as plausible in light of the local environmental factors.The Twitter data, studied previously in Refs.12 and 14, comprise a reciprocal follower network of N = 595, 460 nodes and the time-stamp record of N twt = 12, 054, 205 tweets, of which N ret = 1, 687, 704 are retweets, within a total time frame of T = 33 days and we treat a day as the time step.The data were collected in three data sets: (1), a reciprocal follower network where each edge is a pair of Twitter users who are following each other; (2), tweet timeline data with the hashtags and their adopters sorted by timestamp; (3), the retweet timeline data where each line is a hashtag followed by the sequence of its adopters retweeting about this hashtag from other users sorted by timestamp.Note that the retweet data set is a subset of the tweet data set.

Generating functions.
The modeling of human factors-specifically a dynamical process with limited user memory length-can help to unveil the core features of contagion in complex social systems driven by peer-to-peer influence.At every time step, a user generates a new tweet with innovation probability β = (N twt − N ret )/N T .The infectivity λ 0 of a cascade is the probability that a follower will retweet it in one time step.Let us consider the dynamical process of retweeting in more detail by focusing on a given information cascade with infectivity λ 0 , posted online at time t = 0, assuming for simplicity that all other cascades have infectivity equal to its mean, λ 0 .We denote the distribution of retweets at time t by q n (t), which is the probability that a cascade has popularity n at t.Following the probability generating function (PGF) formalism in Refs.13, 19, 20, we define the cascade PGF, parameterized by x, to be H(t, x) ≡ ∞ n=1 q n (t)x n .We assume the in-degree of all nodes to be k , and characterize the heterogeneity of the out-degree distribution with PGF f (x) ≡ ∞ k=0 p k x k , where p k is the probability of a node with out-degree k.We seek to quantify G(t, x) as the PGF for the retweet distribution at time t of a random cascade branch that originates from a single user randomly chosen from a given cascade.For the user and all of her followers, a tweet event increases the popularity of the given cascade by 1, and places it at the top of the memory length window.As a result, the PGF for the number of tweets at time t is given by [13] Denoting the rate of a user's tweet activity as ρ = (β( k + 1) + λ 0 k M )/M , and following the analysis from Ref. 13, the differential equation for G(t, x) is obtained (see Appendix B): which can be solved with initial conditions f (1) = k and G(0, x) = 1.
The above PGF provides a prediction of the expected popularity m(t) for the focal tweet at time t, and by definition the number of retweets is m(t) − 1.In the case of constant infectivity with no decay effect, equation (B8) leads to (see Appendix B) where τ ≡ 1/(ρ − λ 0 ( k − 1)).When λ 0 is small enough such that τ > 0, equation ( 2) suggests that the popularity converges to a finite level.In contrast, for λ 0 large enough and τ < 0, equation (2) indicates that popularity grows exponentially with time.The threshold separating these two behaviours is at Above this threshold, information can spread to a global scale; However, when t → ∞ the exponential growth prediction m(t) → ∞ does not conform with real data, calling for additional effects to reproduce the empirical process.

Decay factor and infectivity estimation.
Previous studies have found that the attractiveness of online information does not remain constant over an indefinite period of time, but rather gradually declines as it grows older [21].We adopt this observation of fading popularity by incorporating a decay factor α and assume that the infectivity of cascade i decays exponentially by λ i (t) = λ i0 e −α(t−ti0) , where t i0 is the time of the initial tweet.Among retweets for which we can identify at least one of the previous tweets in the same cascade posted by their neighbours, a fraction ψ = 0.69 of them occurred within one day after the tweet was last seen by the retweeted user.Using a mean-field approach that assumes the degree of all nodes to be equal to k , we then express the average number of retweets of cascade i at time t as a i,t = λ i0 e −αt k a i,t−1 /ψ.
We define the number of total retweets of cascade i at time t as A i,t , and derive the conditional expectation of A i,t given that cascade i is retweeted at least once during its lifetime: Here we make two assumptions about the retweet size and infectivity of cascades: first, the tweet will either be stifled by stochastic fluctuations at the beginning such that no followers retweet it, or will be retweeted with probability k λ i (t)ψ −1 and reach the mean size determined by equation ( 4) at time t; second, for fixed values of t and A i,t , the infectivity λ i0 calculated by equation ( 4) is the minimum rate to reach a retweet size ≥ A i,t .We further assume that the relation between the number of retweets S i in the real Twitter data and A i,t is S i = A i,t | t→∞ .Then we set t = 25 to fit the spread rate distribution in equation ( 4).As such, we can obtain (λ i0 , S i ) pairs such that their probability distribution satisfies P (S ≥ S i ) = P (λ 0 ≥ λ i0 ), which can be used to approximately estimate the distribution of λ 0 from empirical Twitter data (Appendix C).
The above analysis has taken the decay effect into account.We next approximate the distribution of initial infectivity λ i0 for cascade i as a truncated lognormal form with an upper bound probability λ max .Let p 0 (λ 0 ) be the lognormal distribution p 0 (λ 0 ) = (λ 0 σ √ 2π) −1 e −(ln λ0−µ) 2 /2σ 2 , where µ and σ are parameters, and the normalization factor for the infectivity distribution can be written as P 0 (λ max ) = λmax 0 p 0 (λ 0 )dλ 0 .Thus we have the probability distribution of infectivity p infectivity (λ 0 ) = p 0 (λ 0 )/P 0 (λ max ) in the truncated lognormal form with 0 < λ 0 < λ max .If a random user tweets a cascade with initial infectivity λ 0 , and it stays in the followers' memory for an average lifetime 1/ψ, the probability that it is not retweeted by any follower is (1 − λ 0 ) k /ψ .Therefore, the fraction of cascades being retweeted at least once is given by This expression captures the fact that information cascades are likely to be stifled due to stochastic fluctuations at the initial stage, before it actually starts spreading.Assuming the infectivity is small such that [1 − (1 − λ 0 ) k /ψ ] λ 0 k /ψ, we have where erf(x) is the error function.We then estimate (λ i0 , S i ) pairs from empirical data with a pre-assumed decay factor α from equation 4, and fit the outcome distribution with equation 6 (see Fig. 4a).

Simulations.
The simulations start with a set of users generating tweets, the infectivity of which follow a truncated lognormal probability distribution, with a universal decay factor governing their long time dynamics.When a user tweets a new message by herself, or retweets an old message from her followees, illustrated in Fig. 1, all of her followers will receive the message.A user will only see the latest tweets within her memory length, which is a fixed value for all users [11,15,22,23].A natural measure of popularity is the number of retweets plus one that accounts for the original tweet, and we regard each not-retweeted tweet as a cascade with popularity 1.The innovation probability (the probability that a user generates a brand new tweet) β = 0.528 is calculated from Twitter data.
The mean degree of the Twitter follower network is k = 47.94 with a total number of N cas = N twt − N ret = 10, 366, 501 cascades, of which 962, 341 are cascades with popularity > 1.Each time step a user retweets or creates on average N twt /N T cascades that will be retweeted λ k N twt /N T times by her followers in the next time step, leading to an estimate of average infectivity as λ = ψN ret / k N twt = 0.002.Memory length can thus be estimated by M = ψN ret / λ N T = 43, and the threshold λ in equation (B12) is 0.015.We use decay parameter α = 0.01, and the corresponding infectivity distribution parameterized by µ = ln 0.0012, σ = ln 2.4 and λ max = 0.017 to obtain the blue curve in Fig. 4a fitting to the red dots of (λ i0 , S i ) pairs calculated from Twitter data.
In all simulations, we first run a burn-in period of 100 time steps.As the Twitter data focus on new memes (see Appendix A), we only analyse new cascades that originate in the next T = 33 time steps (see Appendix D for more details).innovated or retweeted, will appear on the screen of its followers, by overwriting existing tweets.To simplify the analysis, we assume that during updates any of the old existing tweets will be overwritten with the same probability.Thus if a user receives l new tweets from her followed nodes, we randomly pick l slots on her screen to clear out to write the new ones on.
If the focal tweet is tweeted by the user, then it will be cleared from her screen.The vacant slot will be filled in by a randomly chosen tweet whose infectivity is λ 0 .At any time, as a user has k followed nodes, there will be on average ( k + 1)β newly generated tweets and λ 0 k M retweeted existing tweets in the next time step.If a user knows the focal tweet already, in other words she has the tweet on the screen, then the probability that the focal tweet will be overwritten in the next time step is Throughout this paper we set parameters so that β( k +1)+ λ0 k M M < 1.Thus the overwriting probability is given by The tweet we are interested in starts to spread from a randomly chosen root screen.Each retweet of the tweet adds 1 to the popularity.We denote G(a, x) as the probability generating function (PGF) of the excess popularity distribution.At age a (i.e., at time t + a, where t is the birth time for the focal tweet), we define the PGF H(a, x) for the popularity distribution of our focal tweet [13] H(a, x) where q n (a) is the probability that the tweet has been retweeted n times.It is also convenient to define the PGF G (k) (a, x) for the popularity distribution that the focal tweet originates from a root screen with out-degree k [19,20] G(a, x) and For simplicity, we just focus on the model with only one node with the tweet on her screen at the initial stage.Now consider the focal tweet posted up for the first time on a screen with out-degree k (call this screen S1), at time 0. We let T (a) be the random variable for the number of tweets originated from a randomly picked node, and T k (a) the number of tweets originated from a node with degree k, at time a for the focal tweet.In other words, the tweet has age a at the observation time.At the next time step ∆t, there will be three possible outcomes on screen S1 that contribute to the PGF G (k) (a, x): (1) The tweet is retweeted, then removed from the screen S1, and shows up on the screens of all its k followers.This happens with probability λ 0 ∆t, and the number of tweets under this scenario, denoted by T k,1 (a), can be further rewritten by T k,1 (a) = 1 + kT (a − ∆t), as the degree of the followers are random.Note that at time ∆t, the age will be a − ∆t at the observation time.This contributes x[G(a − ∆t, x)] k to G (k) (a, x).
(2) The tweet is not retweeted but overwritten by other tweets appearing on screen S1 during this time period.This happens with probability (1 − λ 0 ∆t)ρ∆t = ρ∆t + o((∆t) 2 ), and the number of tweets for this outcome is T k,2 (a) = 0.This contributes 1 to G (k) (a, x).
(3) The tweet doesn't retweet, and it survives this period of time.This happens with probability (1 Putting (1), ( 2) and (3) together, as each outcome is independent and exclusive to the others, we have which is correct to first order in ∆t.Regarding ∆t → 0 we arrive at with m(0) = 1.We now make further observations about the infectivity λ 0 of the focal tweet.
The focal tweet has a constant infectivity during the entire diffusion process.We use τ = 1/(ρ − λ 0 ( k − 1)) to rewrite equation (B10) to obtain the following result: Here a spreading threshold appears with It shows that tweets with infectivity less than λ0 typically won't successfully spread out; they are likely to be forgotten before being retweeted even once.To test whether the decay effect of infectivity affects the results of our model, we also run simulations with different parameter settings: When α = 0.001, we fix µ = ln 0.0012, σ = ln 2.4 and change λ max to 0.0158; When α = 0.02, we also fix µ = ln 0.0012, σ = ln 2.4 but change λ max to 0.018.
With the above new parameter settings, we run simulations on the Twitter network, reconfigured random network that preserves the degree distribution of the empirical Twitter network, and a synthetic network [18] with powerlaw exponent γ = 2.8 to verify results in the main text.The selected networks appear to be reasonable power-law approximations to the degree distribution of the empirical Twitter network, and the simulation results in these networks match the empirical retweet distribution well (9).These findings show that our model is not sensitive to specific network topology with similar degrees of heterogeneity.

FIG. 3 :
FIG.3: Random forest model predictions.We predict whether a cascade will go viral or not; a cascade is viral if it produces more retweets than a certain percentile threshold (θ = 70, 80, 90) of cascades, using community-based features and infectivity estimates that are calculated based on the initial 50 retweets for each cascade.Random forests are trained on sets of features delineated by the labels RG, NM, CB, IB and C&I (see the main text).The classifier including estimated infectivity (IB) typically outperforms the community-based model (CB), while combining all of the community-based and infectivity features (C&I) gives the best predictions overall.a, Precision rates of Twitter data.b, Recall rates of Twitter data.c, Precision rates of retweet data from simulations.d, Recall rates of retweet data from simulations.

0 FIG. 4 :
FIG.4: Simulation parameter settings and results.a, Truncated lognormal fit.Light and dark blue lines are fit with theoretical distribution function equation(6), and the red and orange points are fit with distribution computed from real Twitter data with equation (4).The parameters used in equation (6) are as follows: when decay factor α = 0, µ = ln 0.0012, σ = ln 2.4, λmax = 0.015; when α = 0.01, µ = ln 0.0012, σ = ln 2.4, λmax = 0.017.b, Retweets at time t of cascades originated at time t0 with different decay factors.c-e, Complementary cumulative distribution functions (CCDFs)-the fraction of cascades with more than n retweets for numerical simulations, compared with retweets from empirical Twitter data marked by green points.The model parameters are identical except for the network structure: c, The empirical Twitter follower network with N = 5.95 × 10 5 and k = 47.94;d, Reconfiguration of the empirical Twitter network preserving the degree distribution; e, Scale-free network with N = 5 × 10 5 , k = 48 and exponent γ = 2.8.

FIG. 7 :
FIG. 7:Degree distribution of networks.The degree distribution of the undirected Twitter follower network of reciprocal ties, and other synthetic networks used in our simulations.We later show that when a synthetic network has a similar degree distribution to the Twitter network, we could reproduce the cascade size distribution of retweets.

TABLE IV :
Logistic models of viral cascade prediction in simulation data with estimated infectivity λ0.In all columns, variables such that p < .05are highlighted with one asterisk, while variables such that p < .01 are highlighted with two asterisks.Standard errors are shown in parentheses.Note that as we do not allow one node to retweet the same cascade more than once, the number of early adopters for the first 50 retweets is always 50 and therefore not included in the logistic regressions.