<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Predicting Top-k Trends on Twitter using Graphlets and Time Features</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Faculty of Electrical Engineering, Czech Technical University in Prague Technicka 2</institution>
          ,
          <addr-line>16627 Prague</addr-line>
          ,
          <country country="CZ">Czech Republic</country>
        </aff>
      </contrib-group>
      <fpage>52</fpage>
      <lpage>57</lpage>
      <abstract>
        <p>We introduce a novel method for predicting trending keywords on Twitter. This new method exploits topology of the studied parts of the social network. It is based on a combination of graphlet spectra and so-called time features. We show experimentally that using graphlets and time features is bene cial for the accuracy of prediction.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>In this paper, we present a method which exploits information about graph
structure of sub-networks of the social network Twitter for making better predictions
about which topics will get among the top k. We show experimentally that with
information about the graph structure we are able to obtain better predictive
accuracies than with a model trained on the same data which does not use
information about the graph structure. Importantly, the presented method does not
need access to the entire graph structure as it works only with certain sets of
derived attributes, which makes it potentially possible to combine the method
with sampling strategies and also to make it able to work in differentially private
settings.</p>
      <p>
        As the network structure has been proved to play an important role in
spreading social trends [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], we want to exploit the effect of social network topology
beyond the scope of previous works (e.g. beyond merely measuring nodes' degrees,
centrality etc.). Inspired by creating network signatures from graphlet degree
distributions [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] in biological networks, we use similar representation to re ect a
trend presence within our network. For that we create graphlet features - small
connected subgraphs, representing various local relative topology options, and
measure their presence in the network by means of subgraph matching. The
network trend signatures, calculated from the frequencies of respective features
occurrences, are then used as feature vectors for standard machine learning
algorithms.
time it enables users to connect to others through the follows relationship. The
users that a particular user is following through this relation are referred as
his friends. Users on the other side who are following the particular user are
referred simply as his followers. Tweets posted by a particular user are stored
and displayed as a chronological sequence in user's timeline. Each such a tweet
being posted is also broadcasted to the users followers. Tweets are, by default,
public, which means that anyone can list them out through Twitter's search
engine or other Twitter API facilities and join the related conversation. Moreover
Twitter users can engage in a direct conversation between each other. As for the
information content, users can group posts together by type with the use of
hashtags - words or phrases pre xed with a \#" sign, referring a tweet to the
speci ed topic. Hashtag signed tweets have special treatment in Twitter's engine
and can be easily searched out.
      </p>
      <p>Now, we de ne the prediction problem that we will be dealing with in this
paper, namely the problem of predicting the top-k trends. Unlike original
Twitter engine, we consider trending topics clearly by measuring the frequency of
occurrence of corresponding hashtag in the network. If the relative frequency
of hashtag in a particular timeframe is among the top-k, we declare it a trend.
One can imagine a web page which gives its users a list of k hashtags which are
predicted to get among the hottest topics in his subnetwork in the near future.</p>
      <p>
        Learning is performed on data as a time series, where each hashtag occurrence
information goes into a prepared time-fold according to its time of creation. The
task is to predict which hashtags will be trending in the future target time-folds
(determined to day intervals). Unlike in the case of the basic supervised learning
task, there is an additional constraint on the output of the classi er. On every
single day, the classi er must mark as trending exactly k hashtags. To satisfy
this constraint, the classi er takes the probability distribution of classi cation
given by the learned Random Forest [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] model and creates respective ranking
on the instances that are subject to the current prediction. That means that
only the top k instances classi ed with highest con dence as trending will be
considered positive. This k-set will then be compared with the true top-k list for
the target day. The natural measure of quality of such a prediction, denoted as
top-k% metric here, is the percentage of correctly predicted topics in the target
list.
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Simple and Baseline Models</title>
      <p>In order to assess the contribution of graphlets and time features to accuracy
of prediction, we created two models which we call simple model and baseline
model and which serve as a baseline in this paper. In these approaches we
wittingly ignore the social graph structure and take the problem as a time series
prediction, which is the case of most methods found in literature. The simple
model method represents the common sense approach to the statistics measured.
It builds on basic average occurrence of the hashtags, calculated over all
timefolds in the training part of the time-window, and treats them as if they were to
o
#
#
o
o
o</p>
      <p>
        o
#
#
#
o
o
continue constantly with that occurrence in the target part. The baseline learner
represents a classical time-series prediction method, with the use of a model to
predict future values based on previously observed values in data with natural
temporal ordering. To make a clear comparison of the models used, we turn the
time series forecasting task into a standard classi cation problem, using a sliding
window technique [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. Since our main focus lies with the features extracted, it
always uses the same machine learning algorithm as the graph learner.
4
      </p>
    </sec>
    <sec id="sec-3">
      <title>A Model Based on Graphlets and Time Features</title>
      <p>The term graphlet, as used in this paper, refers to a small directed graph (with
up to 3 nodes) which contains at least one node labelled by \#". Examples of
graphlets are shown in Figure 1. For every day D and every hashtag H, the
snapshot of the sub-network is a directed labelled graph constructed as follows.
There is one node for every user. There is a directed edge between two users Ui
and Uj if and only if the user Ui follows the user Uj . A node is labelled by \#"
if and only if the user corresponding to this node used the hashtag H on the
day D in at least one tweet. Given a list of graphlets Lg and a snapshot S of
the sub-network we can construct a so-called frequency-feature vector as follows.
For every graphlet gi 2 Lg, we count the number of homomorphisms of gi to the
snapshot graph S (respecting the labels \#") and store the number in the i-th
element of the frequency-feature vector. Clearly, frequency-feature vectors are
not very suitable for prediction of top-k trends because their values are sensitive
to the overall activity of the users on the given day. Therefore we need
socalled rank-feature vectors which can be constructed from the frequency-feature
vectors. Given a set of frequency-feature vectors for all hashtags of interest on
a given day, the i-th element of a rank-feature vector Vrank for a hashtag H
is the rank (i.e. order) of the respective i-th element of the frequency-feature
vector Vfreq corresponding to the same H among all i-th elements of the other
frequency-feature vectors corresponding to the same hashtag H. Given a time
window consisting of several days, one can easily create a graphlet representation
by concatenating the rank-feature vectors corresponding to these days.</p>
      <p>
        The rationale behind the graphlet model is that graphlets can capture how
natural user to user connections in Twitters network affect the topics discussed.
They consist of nodes and edges representing occurrence of hashtag on users
time-line in context of his neighbors, e.g. his followers and friends. A somewhat
similar representation was used in the work of Natasa Przulj for computing
a network structure similarity measure using so called graphlet degree
distribution [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], where graphlets were small connected non-isomorphic induced subgraphs
of a large network. Our relational approach differs in that, with our features, we
generate the subgraphs separately, in advance of further matching in the whole
network, while we do not restrict them to be induced. Even more importantly,
as far as we know, our approach is the rst to use graphlets to model dynamical
processes in complex networks.
      </p>
      <p>Time(A)
#</p>
      <sec id="sec-3-1">
        <title>Positive correlation</title>
        <p>Time(A) &lt; Time(B)
causality
relation
Time(B)
#
Time(A)
#</p>
      </sec>
      <sec id="sec-3-2">
        <title>Negative correlation</title>
        <p>Time(A) &gt; Time(B)
causality
relation</p>
        <p>Time(B)
#</p>
        <p>Besides graphlets we use also so-called time features. The main purpose of
time features is to add a measure of some time properties of the underlying
networks relations. The motivation for this comes from a natural intuition of
trends spread in social networks. In a directed network like Twitter, if the
information is being spread through the network, the fashion of the spreading
should correspond to the network structure. By that we mean that the directed
relations between the users should actually represent the causality links in the
trend spread dynamics. If it is not the case, the information is probably not
coming from the network and is being spread by other channels. Now how to
measure this networks causality correspondence? For a snapshot corresponding
to a hashtag H, we label all the directed edges e = (Ui; Uj ) which connect two
nodes Ui and Uj both of which are labelled by \#", by the time between the
instant when Ui posted the tweet with the hashtag H and the instant when Uj
posted a tweet with the same hashtag. Since the difference is measured against
the direction of the underlying relation, it can in general be negative as depicted
in Figure 2. The time features can then be computed as averages and standard
deviations of these time differences by which the edges are labelled.</p>
        <p>core learners performance comparison
0.84
0.82
0.8
0.78
-][
k%0.76
p
o
t
0.74
0.72
0.7
0.68
simple
baseline
graph
For the testing of our graph-based approach we needed to download a suitable
dataset of tweets from Twitter. We implemented a simple crawler using the
Twitter API. The sampling strategy, i.e. the choice of the set of users that
should be downloaded was driven by a simple heuristic. Starting from a random
seed, the heuristic orders the nodes (corresponding to users) whose neighbours
should be added to the database in a greedy way so that the crawled
subnetwork would be as compact as possible { it picks preferentially those nodes
which share most edges with nodes already stored in the database. The network
subsets that were eventually crawled consist of approx. 8 thousand users with 3
million internal connections, and millions of public tweet (hashtag containing)
records from December 2012, March and April 2013.</p>
        <p>We measured the performance of our novel method and the simple and
baseline methods on the largest dataset from March 2013, with windows consisting
of 4 days of training and 1 day for prediction. We set k to 20 and performed
multiple runs of the classi er with varying seed. We tested our features with two
classi ers, namely SVM and Random Forest, both giving similar results, yet the
later proved more suitable for tuning and time complexity reasons. The choice
of parameters was tuned as to avoid over tting of the classi er, i.e. by
extending the training timescope to at least 4 days, and to have a clear threshold to
cut between trending and non-trending hashtags, i.e. higher k such as 20 helped
to avoid the situation of constant classi cation con dence for all the trending
hashtags.</p>
        <p>The improvement on the top-k% metric achieved by our method, as
displayed in Figure 3, might in reality correspond to early detection of a couple
more upcoming trends that wouldn't be otherwise discovered without taking
the structure of the network into account.</p>
        <p>
          We also performed other experiments with the novel method which we do
not report in detail here due to lack of space but which can be found in [
          <xref ref-type="bibr" rid="ref5">5</xref>
          ]. For
example we evaluated the approach on different metrics, trend de nitions and
parameters. We examined the in uence of various timescope settings, e.g. the
size of train and test parts of the sliding window and various time-fold
granularities. We tested the resilience of the approaches to change of data content
and network structure by an interchange of training sets from multiple datasets,
proving reasonable sensitivity of the graphlet approach both to the change of
the content (negligible) and to the change of the structure (slightly bigger
sensitivity). We also tested whether we could not obtain better results with other
relations, but the results came in the favour of the original follows relation over
the retweets and replies. We also assessed the usefulness of time features. It
turned out that time features contribute to the performance in the order of
several percent. Nevertheless, time features on their own performed worse than
graphlets.
6
        </p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>Conclusions</title>
      <p>In this paper, we presented an approach for prediction of trends spread within
a local Twitter subnetwork, utilizing topology structure information, based on
representation, inspired by methods from the area of biological networks. The
results prove the value of knowledge on the network structure and the
contribution of the approach itself. One of the appealing properties of the method is
that it exploits information about structure of the network but at the same time
it does not need the entire structure nor it does need to construct models of
individual users.</p>
      <p>Acknowledgements
This work was supported by the Czech Science Foundation grant no. P202/12/2032
and the Czech Technical University internal grant SGS11/155/OHK3/3T/13.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>NA</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>JH</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          :
          <article-title>Social network sensors for early detection of contagious outbreaks (2010) PLoS ONE 5(9): e12948.</article-title>
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>Tijana</given-names>
            <surname>Milenkovic</surname>
          </string-name>
          ,
          <string-name>
            <surname>N.P.</surname>
          </string-name>
          :
          <article-title>Uncovering biological network function via graphlet degree signatures (</article-title>
          <year>2006</year>
          ) Oxford university press.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Breiman</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          :
          <article-title>Random forests (</article-title>
          <year>2001</year>
          ) Statistics Department, University of California, Berkeley, CA 94720.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Dietterich</surname>
          </string-name>
          , T.G.:
          <article-title>Machine learning for sequential data: A review (</article-title>
          <year>2010</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Sourek</surname>
          </string-name>
          , G.:
          <article-title>Twitters local trends spread analysis (</article-title>
          <year>2013</year>
          ) http://cyber.felk.cvut. cz/research/theses/detail.phtml?id=
          <fpage>339</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>