D YNAMIC G RAPH R EPRESENTATION L EARNING VIA S ELF -A TTENTION N ETWORKS
Anonymous authors
Paper under double-blind review
A BSTRACT
Learning latent representations of nodes in graphs is an important and ubiquitous task with widespread applications such as link prediction, node classiﬁcation, and graph visualization.
Previous methods on graph representation learning mainly focus on static graphs, however, many real-world graphs are dynamic and evolve over time.
In this paper, we present Dynamic Self-Attention Network (DySAT), a novel neural architecture that operates on dynamic graphs and learns node representations that capture both structural properties and temporal evolutionary patterns.
Speciﬁcally, DySAT computes node representations by jointly employing self-attention layers along two dimensions: structural neighborhood and temporal dynamics.
We conduct link prediction experiments on two classes of graphs: communication networks and bipartite rating networks.
Our experimental results show that DySAT has a signiﬁcant performance gain over several different stateof-the-art graph embedding baselines.
I NTRODUCTION
Learning latent representations (or embeddings) of nodes in graphs has been recognized as a fundamental learning problem due to its widespread use in various domains such as social media (Perozzi et al., 2014), biology (Grover & Leskovec, 2016), and knowledge bases (Wang et al., 2014).
The basic idea is to learn a low-dimensional vector for each node, which encodes the structural properties of a node and its neighborhood (and possibly attributes).
Such low-dimensional representations can beneﬁt a plethora of graph analytical tasks such as node classiﬁcation, link prediction, and graph visualization (Perozzi et al., 2014;
Tang et al., 2015; Grover & Leskovec, 2016; Wang et al., 2016).
Previous work on graph representation learning mainly focuses on static graphs, which contain a ﬁxed set of nodes and edges.
However, many graphs in real-world applications are intrinsically dynamic, in which graph structures can evolve over time.
They are usually represented as a sequence of graph snapshots from different time steps (Leskovec et al., 2007).
Examples include academic co-authorship networks where authors may periodically switch their collaboration behaviors and email communication networks whose structures may change dramatically due to sudden events.
In such scenarios, modeling temporal evolutionary patterns is important in accurately predicting node properties and future links.
Learning dynamic node representations is challenging, compared to static settings, due to the complex time-varying graph structures: nodes can emerge and leave, links can appear and disappear, and communities can merge and split.
This requires the learned embeddings not only to preserve structural proximity of nodes, but also to jointly capture the temporal dependencies over time.
Though some recent work attempts to learn node representations in dynamic graphs, they mainly impose a temporal regularizer to enforce smoothness of the node representations from adjacent snapshots (Zhu et al., 2016; Li et al., 2017; Zhou et al., 2018).
However, these approaches may fail when nodes exhibit signiﬁcantly distinct evolutionary behaviors.
Trivedi et al.
(2017) employ a recurrent neural architecture for temporal reasoning in multi-relational knowledge graphs.
However, their temporal node representations are limited to modeling ﬁrst-order proximity, while ignoring the structure of higher-order graph neighborhoods.
Attention mechanisms have recently achieved great success in many sequential learning tasks such as machine translation (Bahdanau et al., 2015) and reading comprehension (Yu et al., 2018).
The key underlying principle is to learn a function that aggregates a variable-sized input, while focusing on the parts most relevant to a certain context.
When the attention mechanism uses a single sequence as both the inputs and the context, it is often called self-attention .
Though attention mechanisms were initially designed to facilitate Recurrent Neural Networks (RNNs) to capture long-term dependencies, recent work by Vaswani et al.
(2017) demonstrates that a fully self-attentional network itself can achieve state-of-the-art performance in machine translation tasks.
Velickovic et al.
(2018) extend self-attention to graphs by enabling each node to attend over its neighbors, achieving state-of-the-art results for semi-supervised node classiﬁcation tasks in static graphs.
As dynamic graphs usually include periodical patterns such as recurrent links or communities, attention mechanisms are capable of utilizing information about most relevant historical context, to facilitate future prediction.
Inspired by recent work on attention techniques, we present a novel neural architecture named Dynamic Self-Attention Network (DySAT) to learn node representations on dynamic graphs.
Speciﬁcally, we employ self-attention along two dimensions: structural neighborhoods and temporal dynamics, i.e. , DySAT generates a dynamic representation for a node by considering both its neighbors and historical representations, following a self-attentional strategy.
Unlike static graph embedding methods that focus entirely on preserving structural proximity, we learn dynamic node representations that reﬂect the temporal evolution of graph structure over a varying number of historical snapshots.
In contrast to temporal smoothness-based methods, DySAT learns attention weights that capture temporal dependencies at a ﬁne-grained node-level granularity.
We evaluate our framework on the dynamic link prediction task using four benchmarks of different sizes including two email communication networks (Klimt & Yang, 2004; Panzarasa et al., 2009) and two bipartite rating networks (Harper & Konstan, 2016).
Our evaluation results show that DySAT achieves signiﬁcant improvements (3.6% macro-AUC on average) over several stateof-the-art baselines and maintains a more stable performance over different time steps.
R ELATED W ORK
Our framework is related to previous representation learning techniques on static graphs, dynamic graphs, and recent developments in self-attention mechanisms.
Static graph embeddings.
Early work on unsupervised graph representation learning exploits the spectral properties of various graph matrix representations, such as Laplacian, etc. to perform dimensionality reduction (Tenenbaum et al., 2000; Belkin & Niyogi, 2001).
To improve scalability, some work (Perozzi et al., 2014; Grover & Leskovec, 2016) utilizes Skip-gram methods, inspired by their success in Natural Language Processing (NLP).
Recently, several graph neural network architectures based on generalizations of convolutions have achieved tremendous success, among which many methods are designed for supervised or semi-supervised learning tasks (Niepert et al., 2016;
Defferrard et al., 2016; Kipf & Welling, 2017; Sankar et al., 2017; Velickovic et al., 2018).
Hamilton et al.
(2017b) extend graph convolutional methods through trainable neighborhood aggregation functions, to propose a general framework applicable to unsupervised representation learning.
However, these methods are not designed to model temporal evolutionary patterns in dynamic graphs.
Dynamic graph embeddings.
Most techniques employ temporal smoothness regularization to ensure embedding stability across consecutive time-steps (Zhu et al., 2016).
Zhou et al.
(2018) additionally use triadic closure (Kossinets & Watts, 2006) as guidance, leading to signiﬁcant improvements.
Neural methods were recently explored in the knowledge graph domain by Trivedi et al.
(2017), who employ a recurrent neural architecture for temporal reasoning.
However, their model is limited to tracing link evolution, thus limited to capturing ﬁrst-order proximity.
Goyal et al.
(2017) learn incremental node embeddings through initialization from the previous time steps, however, this may not guarantee the model to capture long-term graph similarity.
A few recent works (Nguyen et al., 2018; Zuo et al., 2018) examine a related setting of temporal graphs with continuous timestamped links for representation learning, which is however orthogonal to the established problem setup of using dynamic graph snapshots.
Li et al. (2017) learn node embeddings in dynamic attributed graphs by initially training an ofﬂine model, followed by incremental updates over time. However, their key focus is online learning to improve efﬁciency over re-training static models, while our goal is to improve representation quality by exploiting the temporal evolutionary patterns in graph structure. Unlike previous approaches, our framework captures the most relevant historical contexts through a self-attentional architecture, to learn dynamic node representations.
Self-attention mechanisms.
Recent advancements in many NLP tasks have demonstrated the superiority of self-attention in achieving state-of-the-art performance (Vaswani et al., 2017; Lin et al., 2017; Tan et al., 2018;
Shen et al., 2018; Shaw et al., 2018).
In DySAT, we employ self-attention mechanisms to compute a dynamic node representation by attending over its neighbors and previous historical representations.
Our approach of using self-attention over neighbors is closely related to the Graph Attention Network (GAT) (Velickovic et al., 2018), which employs neighborhood attention for semi-supervised node classiﬁcation in a static graph.
As dynamic graphs usually contain periodical patterns, we extend the self-attention mechanisms over the historical representations of a particular node to capture its temporal evolution behaviors.
P ROBLEM D EFINITION
In this work, we address the problem of dynamic graph representation learning.
A dynamic graph is deﬁned as a series of observed snapshots, G = {G 1 , . . .
, G T } where T is the number of time steps.
Each snapshot G t =
( V , E t ) is a weighted undirected graph with a shared node set V , a link set E t , and weighted adjacency matrix A t at time t .
Unlike some previous work that assumes links can only be added over time in dynamic works, we also allow to remove links.
Dynamic graph representation learning aims to learn latent representations e t v ∈ R d for each node v ∈ V at time steps t = 1 , 2 , . .
, T , such that e tv preserves both the local graph structures centered at v and its evolutionary behaviors prior to time t .
D YNAMIC S ELF -A TTENTION N ETWORK
In this section, we ﬁrst describe the high-level structure of our model.
DySAT consists of two major novel components: structural and temporal self-attention layers, which can be utilized to construct arbitrary graph neural architectures through stacking of layers.
Similar to existing studies on attention mechanisms, we employ multi-head attentions to improve model capacity and stability.
DySAT consists of a structural block followed by a temporal block, as illustrated in Figure 1, where each block may contain multiple stacked layers of the corresponding layer type.
The structural block extracts features from the local neighborhood through self-attentional aggregation, to compute intermediate node representations for each snapshot.
These representations feed as input to the temporal block, which attends over multiple time steps, capturing temporal variations in the graph.
4. S TRUCTURAL SELF - ATTENTION
The input of this layer is a graph snapshot G ∈ G and a set of input node representations { x v ∈ R D , ∀ v ∈ V} where D is the input embedding dimension.
The input to the initial layer can be set as 1-hot encoded vectors for each node (or attributes if available).
The output is a new set of node representations { z v ∈ R F , ∀ v ∈ V} with F dimensions that capture local structural properties.
Speciﬁcally, the structural self-attention layer attends over the immediate neighbors of a node v (in snapshot G ), by computing attention weights as a function of their input node embeddings.
The structural attention layer is a variant of GAT (Velickovic et al., 2018), applied on a single snapshot:
[Equation]
where N v = { u ∈ V : ( u, v ) ∈ E} is the set of immediate neighbors of node v in snapshot G ;
W s ∈ R D × F is a shared weight transformation applied to each node in the graph; a ∈ R 2 D is a weight vector parameterizing the attention function implemented as feed-forward layer; || is the concatenation operation and σ ( · ) is a non-linear activation function.
Note that A uv is the weight of link ( u, v ) in the current snapshot G .
The set of learned coefﬁcients α uv , obtained by a softmax over the neighbors of each node, indicate the importance or contribution of node u to node v at the current snapshot.
We use a LeakyRELU non-linearity to compute the attention weights, followed by
ELU for the output representations.
In our experiments, we employ sparse matrices to implement the masked self-attention over neighbors. [Figure] v [Figure]
[Figure] # v
[Figure]
[Figure]
[Figure] Timeline
To further capture temporal evolutionary patterns in a dynamic network, we design a temporal selfattention layer.
The input of this layer is a sequence of representations of a particular node v at different time steps.
Speciﬁcally, for each node v , we deﬁne the input as { x 1 v , x 2 v , . . .
, x Tv } , x tv ∈
R D (cid:48) where T is the number of time steps and D (cid:48) is the dimensionality of the input representations.
The layer output is a new representation sequence for v at each time step, i.e. , z v = { z 1 v , z 2 v , . . .
, z Tv } , z tv ∈ R F (cid:48) with dimensionality F (cid:48) .
We denote the input and output representations of v , packed together across time, by matrices X v ∈ R T × D (cid:48) and Z v ∈ R T × F (cid:48) respectively.
The key objective of the temporal self-attentional layer is to capture the temporal variations in graph structure over multiple time steps.
The input representation of node v at time-step t , x tv , constitutes an encoding of the current local structure around v .
We use x tv as the query to attend over its historical representations ( < t ), tracing the evolution of the local neighborhood around v .
Thus, temporal self-attention facilitates learning of dependencies between various representations of a node across different time steps.
To compute the output representation of node v at t , we use the scaled dot-product form of attention (Vaswani et al., 2017) where the queries, keys, and values are set as the input node representations.
The queries, keys, and values are ﬁrst transformed to a different space by using linear projections matrices W q ∈ R D (cid:48)
× F (cid:48) , W k ∈ R D (cid:48) × F (cid:48) and W v ∈ R D (cid:48) × F (cid:48) respectively.
Here, we allow each time-step t to attend over all time-steps up to and including t , to prevent leftward information ﬂow and preserve the auto-regressive property.
The temporal self-attention is deﬁned as:
[Equation]
where β v ∈ R T × T is the attention weight matrix obtained by the multiplicative attention function and
M ∈ R T × T is a mask matrix with each entry M ij ∈ {−∞ , 0 } .
When M ij = −∞ , the softmax function results in a zero attention weight, i.e. , β ijv = 0 , which switches off the attention from time-step i to j .
To encode the temporal order, we deﬁne M as:
[Equation]
4. M ULTI -H EAD A TTENTION
We additionally employ multi-head attention (Vaswani et al., 2017) to jointly attend to different subspaces at each input, leading to a leap in model capacity.
We use multiple attention heads, followed by concatenation, in both structural and temporal self-attention layers:
Structural multi-head self-attention:
[Equation]
Temporal multi-
[Equation]
where H is the number of attention heads, h v ∈ R F and H v ∈ R T × F (cid:48) are the outputs of structural and temporal multi-head attentions respectively.
Note that while structural attention is applied on a single snapshot, temporal attention operates over multiple time-steps.
4. D Y SAT A RCHITECTURE
In this section, we present our neural architecture DySAT for Dynamic Graph Representation Learning, that uses the above deﬁned structural and temporal self-attention layers as fundamental modules.
As shown in Figure 1, DySAT has three modules from its top to bottom, (1) structural attention block, (2) temporal attention block, and (3) graph context prediction.
The model takes as input a collection of T graph snapshots, and generates outputs latent node representations at each time step.
Structural attention block.
This module is composed of multiple stacked structural self-attention layers to extract features from nodes at different distances.
We apply each layer independently at different snapshots with shared parameters, as illustrated in Figure 1, to capture local neighborhood structure around a node at each time step.
Note that the embeddings input to a layer can potentially vary across different snapshots.
We denote the node representations output by the structural attention block, as { h 1 v , h 2 v , . . .
, h Tv } , h tv ∈ R f , which feed as input to the temporal attention block.
Temporal attention block.
First, we equip the temporal attention module with a sense of ordering through position embeddings (Gehring et al., 2017), { p 1 , . . .
, p T } , p t ∈ R f , which embed the absolute temporal position of each snapshot.
The position embeddings are then combined with the output of the structural attention block to obtain a sequence of input representations: { h 1 v + p 1 , h 2 v + p 2 , . .
, h Tv + p T } for node v across multiple time steps.
This block also follows a similar structure with multiple stacked temporal self-attention layers.
The outputs of the ﬁnal layer pass into a position-wise feed-forward layer to give the ﬁnal node representations { e 1 v , e 2 v , . . .
, e Tv } ∀ v ∈ V .
Graph context prediction.
To ensure that the learned representations capture both structural and temporal information, we deﬁne an objective function that preserves the local structure around a node, across multiple time steps.
We use the dynamic representations of a node v at time step t , e tv to predict the occurrence of nodes appearing the local neighborhood around v at t .
In particular, we use a binary cross-entropy loss function at each time step to encourage nodes co-occurring in ﬁxed-length random walks, to have similar representations.
[Equation]
where σ is the sigmoid function, < .
> denotes the inner product operation, N twalk ( v ) is the set of nodes that co-occur with v on ﬁxed-length random walks at snapshot t , P tn is a negative sampling distribution for snapshot G t , and w n , negative sampling ratio, is a tunable hyper-parameter to balance the positive and negative samples.
E XPERIMENTS
We evaluate the quality of our learned node representations on the fundamental task of dynamic link prediction.
We choose this task since it has been widely used (Trivedi et al., 2017; Goyal et al., 2017;
Li et al., 2018) in evaluating the quality of dynamic node representations to predict the temporal evolution in graph structure.
In our experiments, we compare the performance of DySAT against a variety of static and dynamic graph representation learning baselines.
Our experimental results on four publicly available benchmarks indicate that DySAT achieves signiﬁcant performance gains over other methods. [Table]
5. D ATASETS
We use four dynamic graph datasets with two communication and bipartite rating networks each.
Communication networks.
We consider two publicly available communication network datasets:
Enron (Klimt & Yang, 2004) and UCI (Panzarasa et al., 2009).
In Enron, the communication links are email interactions between core employees and the links in UCI represent messages sent between users on an online social network platform.
Rating networks.
We use two bipartite rating networks from Yelp 1 and MovieLens (Harper &
Konstan, 2016).
In Yelp, the dynamic graph comprises links between two types of nodes, users and businesses, derived from the observed ratings over time.
ML-10M consists of a user-tag interaction network where user-tag links connects users with the tags they applied on certain movies.
In each dataset, multiple graph snapshots are created based on the observed interactions in ﬁxedlength time windows.
Dataset statistics are shown in Table 1, while Appendix G has further details.
5. E XPERIMENTAL S ETUP
We conduct experiments on the task of link prediction in dynamic graphs, where we learn dynamic node representations on snapshots {G 1 , . . .
, G t } and use { e tv , ∀ v ∈ V} to predict the links at G t + during evaluation.
We compare different models based on their ability to correctly classify each example (node pair) into links and non-links.
To further analyze predictive capability, we also evaluate new link prediction, with a focus on new links that appear at each time step, (Appendix B).
We evaluate the performance of different models by training a logistic regression classiﬁer for dynamic link prediction (Zhou et al., 2018).
We create evaluation examples from the links in G t +1 and an equal number of randomly sampled pairs of unconnected nodes (non-links).
A held-out validation set (20% links) is used to tune the hyper-parameters across all models, which is later discarded. We randomly sample 25% of the examples for training and use the remaining 75% as our test set.
We repeat this for 10 randomized runs and report the average performance in our results.
We follow the strategy recommended by Grover & Leskovec (2016) to compute the feature representation for a pair of nodes, using the Hadamard Operator ( e tu (cid:12) e tv ), for all methods unless explicitly speciﬁed otherwise.
The Hadamard operator computes the element-wise product of two vectors and closely mirrors the widely used inner product operation in learning node embeddings.
We evaluate the performance of link prediction using Area Under the ROC Curve (AUC) scores (Grover & Leskovec, 2016).
We also report the average precision scores in Table 6 of the Appendix.
We implement DySAT in Tensorﬂow (Abadi et al., 2016) and employ mini-batch gradient descent with Adam optimizer (Kingma & Ba, 2015) for training.
For Enron, we use a single layer in both the structural and temporal blocks, with each layer comprising 16 attention heads computing 8 features apiece (for a total of 128 dimensions).
In the other datasets, we use two structural self-attentional layers with 16 and 8 heads respectively, each computing 16 features (layer sizes of 256, 128).
The model is trained for a maximum of 200 epochs with a batch size of 256 nodes and the best performing model on the validation set, is chosen for evaluation.
5. B ASELINE
We compare the performance of DySAT with several state-of-the-art dynamic graph embedding techniques.
In addition, we include several static graph embedding methods in comparison to ana- [Table] lyze the gains of using temporal information for dynamic link prediction.
To make a fair comparison with static methods, we provide access to the entire history of snapshots by constructing an aggregated graph upto time t , where the weight of each link is deﬁned as the cumulative weight till t agnostic of its occurrence times.
We use author-provided implementations for all the baselines and set the ﬁnal embedding dimension d = 128 .
We compare against several state-of-the-art unsupervised static embedding methods: node2vec (Grover & Leskovec, 2016), GraphSAGE (Hamilton et al., 2017b) and graph autoencoders (Hamilton et al., 2017a).
We experiment with different aggregators in GraphSAGE, namely, GCN, mean-pooling, max-pooling, and LSTM, to report the performance of the best performing aggregator in each dataset.
To provide a fair comparison with GAT (Velickovic et al., 2018), which originally conduct experiments only on node classiﬁcation, we implement a graph attention layer as an additional aggregator in GraphSAGE, which we denote by GraphSAGE + GAT. We also train GCN and GAT as autoencoders for link prediction along the suggested lines of (Zitnik et al., 2018), denoted by GCN-AE and GAT-AE respectively.
In the dynamic setting, we evaluate DySAT against the most recent studies on dynamic graph embedding including
Know-Evolve (Trivedi et al., 2017), DynamicTriad (Zhou et al., 2018), and DynGEM (Goyal et al., 2017).
The details of hyper-parameter tuning for all methods can be found in Appendix F.
5. E XPERIMENTAL R ESULTS
We evaluate the models at each time step t by training separate models up to snapshot t and evaluate at t + 1 for each t = 1 , . . .
, T .
We summarize the micro and macro averaged AUC scores (across all time steps) for all models in Table 2.
From the results, we observe that DySAT achieves consistent gains of 3–4% macro-AUC, in comparison to the best baseline across all datasets.
Further, we compare the model performance at each time step (Figure 2), to obtain a deep understanding of their temporal behaviors.
We ﬁne the performance of DySAT to be relatively more stable than other methods.
This contrast is pronounced in the communication networks (Enron and UCI), where we observe drastic drops in performance of static embedding methods at certain time steps.
The runtime per mini-batch of DySAT on ML-10M, using a machine with Nvidia Tesla V100 GPU and 28 CPU cores, is 0.72 seconds.
In comparison, a model variant without temporal attention (Appendix A) takes 0.51 seconds, which illustrates the relatively low cost of temporal attention.
D ISCUSSION
Our experimental results provide several interesting observations and insights to the performance of different graph embedding techniques.
First, we observe that GraphSAGE achieves comparable performance to DynamicTriad across different datasets, despite being trained only on static graphs.
One possible explanation may be that
GraphSAGE uses trainable neighbor-aggregation functions, while DynamicTriad employs Skipgram based methods augmented with temporal smoothness.
This leads us to conjecture that the combination of structural and temporal modeling with expressive aggregation functions, such as [Figure] multi-head attention, is responsible for the consistently superior performance of DySAT on dynamic link prediction.
We also observe that node2vec achieves consistent performance agnostic of temporal information, which demonstrates the effectiveness of second-order random walk sampling.
This observation points to the direction of applying sampling techniques to further improve DySAT.
In DySAT, we employ structural attention layers followed by temporal attention layers.
We choose this design because graph structures are not stable over time, which makes directly employing structural attention layers after temporal attention layers infeasible.
We also consider another alternative design choice that applies self-attention along the two dimensions of neighbors and time together following the strategy similar to (Shen et al., 2018).
In practice, this would be computationally expensive due to variable number of neighbors per node across multiple snapshots.
We leave exploring other architectural design choices based on structural and temporal self-attentions as future work.
In the current setup, we store the adjacency matrix of each snapshot in memory using sparse matrix, which may pose memory challenges when scaling to large graphs.
In the future, we plan to explore DySAT with memory-efﬁcient mini-batch training strategy along the lines of GraphSAGE (Hamilton et al., 2017b).
Further, we develop an incremental self-attention network (IncSAT) that is efﬁcient in both computation and memory cost as a direct extension of DySAT.
Our initial results are promising as reported in Appendix E, which opens the door to future exploration of self-attentional architectures for incremental (or streaming) graph representation learning.
We also evaluate the capability of DySAT on multi-step link prediction or forecasting and observe signiﬁcant relative improvements of 6% AUC on average over existing methods, as reported in Appendix C.
C ONCLUSION
In this paper, we introduce a novel self-attentional neural network architecture named DySAT to learn node representations in dynamic graphs.
Speciﬁcally, DySAT computes dynamic node representations using self-attention over the (1) structural neighborhood and (2) historical node representations, thus effectively captures the temporal evolutionary patterns of graph structures.
Our experiment results on various real-world dynamic graph datasets indicate that DySAT achieves signiﬁcant performance gains over several state-of-the-art static and dynamic graph embedding baselines.
Though our experiments are conducted on graphs without node features, DySAT can be easily generalized on feature-rich graphs.
Another interesting direction is exploring continuous-time generalization of our framework to incorporate more ﬁne-grained temporal variations. A A NALYSIS OF T EMPORAL A TTENTION
In this section, we conduct an in-depth analysis of the proposed temporal attention layer, to demonstrate its utility and examine the distribution of temporal attention weights.
A. E FFECT OF R EMOVING T EMPORAL L AYERS
To demonstrate the effectiveness of temporal self-attention layers, we conduct an experimental study that removes the temporal attention block from DySAT to create a simpler architecture.
This model is optimized using the same loss function (Eqn. 5) applied on the intermediate representations { h 1 v , h 2 v , . .
, h Tv } for each node v ∈ V .
Note that this model is different from static methods since the structural self-attention block is jointly optimized (using Eqn. 5) across all snapshots without any explicit temporal modeling.
We use the best conﬁguration of DySAT on each dataset from the original experiments to initialize the new model.
The performance comparison is shown in Table 3.
We observe that in some datasets, the structural attention block is able to learn some temporal evolution patterns in graph structure, despite the lack of explicit temporal modeling.
However, the new model is consistently inferior to DySAT and we observe that the original DySAT has a 3% average gain in Macro-AUC, which validates our choice of using temporal self-attentional layers. [Table] (micro and macro averaged AUC with standard deviation)
A. V ISUALIZATION OF T EMPORAL A TTENTION W EIGHTS
We conduct a qualitative analysis to obtain deeper insights into the distribution of temporal attention weights learned by DySAT.
In this experiment, we examine the temporal attention coefﬁcients learned at each time step t , which indicate the relative importance of each historical snapshot ( < t ) in predicting the links at t .
We choose the Enron dataset to visualize the mean and standard deviation of temporal attention coefﬁcients, over all the nodes.
Figure 3 visualizes a heatmap of the learned temporal attention weights on Enron dataset for the ﬁrst 10 time steps.
From Figure 3, we observe that the mean temporal attention weights are mildly biased towards recent snapshots, while the historical snaphots vary in their importance across different time steps.
Further, we ﬁnd that the standard deviation of attention weights across different nodes is generally high and exhibits more variability.
Thus, the temporal attention weights are well distributed across historical snapshots, with signiﬁcant variance across different nodes in the graph.
While this analysis attempts to provide a high-level perspective on the weights learned by temporal attention, an appropriate interpretation of these coefﬁcients (as done by e.g. , (Bahdanau et al., 2015)) requires further domain knowlege about the dataset under study, and is left as future work.
[Figure]
B D YNAMIC N EW L INK P REDICTION
In this section, we additionally report the results of dynamic link prediction evaluated only on the new links at each time step.
This provides an in-depth analysis on the capabilities of different methods in predicting relatively unseen links.
We follow the same evaluation setup of training a downstream logistic regression classiﬁer for dynamic link prediction.
However, a key difference is that the evaluation examples comprise new links at G t +1 (that are not in G t ) and an equal number of randomly sampled non-links.
Table 4 summarizes the micro and macro averaged AUC scores for different methods on the four datasets.
The absolute performance numbers of all methods are lower than the original evaluation setup of using all links at G t +1 , which is reasonable since accurate prediction of new links at G t + is expected to be slightly more challenging in comparison to predicting all the links at G t
+1 .
From
Table 2)
[Table]
we ﬁnd that DySAT achieves consistent relative gains of 3–5% Macro-AUC over the best baselines on dynamic new link prediction as well, thus validating its effectiveness in accurately capturing temporal context for new link prediction
[Table]
C M ULTI -S TEP L INK P REDICTION
In this section
[Table]
we evaluate various dynamic graph representation learning methods on the task of multi-step link prediction or forecasting.
Here, each model is trained for a ﬁxed number of time steps, and the latest embeddings are used to predict links at multiple future time steps.
In each dataset, we choose the last 6 snapshots to evaluate multi-step link prediction.
The model is trained on the previous remaining snapshots, and the latest embeddings are used to forecast links at future time steps.
For each future time step t +∆ (1 ≤ ∆ ≤ 6) , we create examples from the links in G t +∆ and an equal number of randomly sampled pairs of unconnected nodes (non-links).
We otherwise use the same evaluation setup of training a downstream logistic regression classiﬁer to evaluate link prediction.
In this experiment, we exclude the links formed by nodes that newly appear in the future evaluation snapshots, since most methods cannot be easily support updates for new nodes.
Figure.
4 depicts the variation in model performance of different methods over the 6 evaluation snapshots.
As expected, we observe a slight decay in performance over time for all the models.
DySATachieves signiﬁcant performance gains over all other baselines and maintains a highly stable link prediction performance over multiple future time steps.
Static embedding methods often exhibit large variations in performance over time steps, while DySAT achieves a stable consistent performance.
The historical context captured by the dynamic node embeddings of DySAT, is one of the most likely reasons for its stable multi-step forecasting performance.
[Figure]
D I MPACT OF UNSEEN NODES ON D YNAMIC L INK P REDICTION
In this section
[Figure]
we analyze the sensitivity of different graph representation learning on link prediction for previously unseen nodes that appear newly at time t
[Figure]
[Figure]
v
[Figure]
[Figure]
# v
[Figure]
[Figure]
Timeline
[Figure]
A node is considered as a new node at time step t in G t if it has not appeared (has no links) in any of the previous t − 1 snapshots.
In this experiment, the evaluation set at time step t only comprises the subset of links at G t +1 among the new nodes in G t and corresponding randomly sampled non-links.
Since the number of nodes varies signiﬁcantly across different time steps, we report the performance of each method along with the number of new nodes at each time step, in Figure 5.
From Figure 5, we observe that DySAT outperforms other baselines in most datasets, demonstrating the ability to characterize new or previously unseen nodes despite their limited history.
Although the temporal attention will focus on the latest representation of a new node v due to absence of history, the structural embedding of v recieves backpropagation signals through the temporal attention on neighboring nodes, which indirectly affects the ﬁnal embedding of v .
We hypothesize that this indirect temporal signal is one of the reasons for DySAT to achieve performance improvements over baselines, albeit not designed to explicitly model historical context for previously unseen nodes.
E I NCREMENTAL S ELF -A TTENTION N ETWORK
In this section, we describe an extension of our dynamic self-attentional architecture to learn incremental node representations.
The motivation of incremental learning arises due to the proliferation in sizes of real-world graphs, making it difﬁcult to store multiple snapshots in memory.
Thus, the incremental graph representation learning problem imposes the restriction of no access to historical graph snapshots, in contrast to most dynamic graph embedding methods.
Speciﬁcally, to learn the node embeddings { e tv ∈ R d ∀ v ∈ V} at time T , we require a model to only access to the snapshot
G T and a summary of the historical snapshots.
For example, DynGEM (Goyal et al., 2017) is an example of an incremental embedding method that uses the embeddings learned at step t − 1 , as initialization to learn the embeddings at t .
We propose an extension of our self-attentional architecture named IncSAT to explore solving the incremental graph representation learning problem.
To learn node representations at T , we ﬁrst incrementally train multiple models at 1 ≤ t ≤ T .
Unlike the original DySAT where structural self-attention is applied at each snapshot, IncSAT applies the structural block only at the latest graph snapshot G t .
We enable incremental learning by storing the intermediate output representations { h Tv ∀ v ∈ V} of the structural block.
As illustrated in Figure 6, these intermediate output representations of historical snapshots (1 ≤ t < T ) can be directly loaded from previously saved results at 1 ≤ t < T .
Thus, the structural information of the previous historical snapshots are summarized in the stored intermediate representations.
The temporal self-attention is only applied to the current [Table] snapshot G T over the historical representations of each node to compute the ﬁnal node embeddings { e Tv ∀ v ∈ V} at T , which are trained on random walks sampled from G T .
We evaluate IncSAT using the same experimental setup, with minor modiﬁcations in hyperparameters.
We use a dropout rate of 0.4 in both the structural and temporal self-attention layers.
From our preliminary experiments, we ﬁnd that a higher dropout rate in the structural block can facilitate avoiding over-ﬁtting the model to the current graph snapshot.
In Table 5, we report the performance of IncSAT in comparison to DySAT and DynGEM, which is the only one that can support incremental training from our baseline models.
The results show that IncSAT achieves comparable performance to DySAT on most datasets while signiﬁcantly outperforming DynGEM, albeit with minimal hyper-parameter tuning.
F D ETAILS ON H YPER - PARAMETER S ETTINGS AND T UNING
In DySAT, the objective function (Eqn. 5) utilizes positive pairs of nodes co-occurring in ﬁxed-length random walks.
We follow the strategy of Deepwalk (Perozzi et al., 2014) to sample walks 10 walks of length 40 per node, each with a context window size of 10.
We use 10 negative samples per positive pair, with context distribution ( P tn ) smoothing over node degrees with a smoothing parameter of 0.75, following (Perozzi et al., 2014; Grover & Leskovec, 2016; Hamilton et al., 2017b).
During training, we apply L 2 regularization with λ = 5 × 10 − 4 and use dropout rates (Srivastava et al., 2014) of 0.1 and 0.5 in the self-attention layers of the structural and temporal blocks respectively.
We use the validation set for tuning the learning rate in the range of { 10 − 4 , 10 − 3 } and negative sampling ratio w n in the range { 0 . 01 , 0 . 1 , 1 } .
We tune the hyper-parameters of all baselines following their recommended guidelines.
For node2vec, we use the default settings as in the paper, with 10 random walks of length 80 per node and context window of 10, trained for a single epoch.
We tune the in-out and return hyper-parameters, p, q using grid-search, in the range { 0 . 25 , 0 .
50 , 1 , 2 , 4 } and report the best results.
In case of GraphSAGE, we train a two layer model with respective neighborhood sample sizes 25 and 10, forepochs, as described in the original paper.
We evaluate the embeddings at each epoch on the validation set, and choose the best for ﬁnal evaluation.
Note that the results of GraphSAGE reported in
Table 2 represent that of best-performing aggregator in each dataset.
For
Know-evolve, we tune the two weight-scale hyper-parameters in the range { 10 − 4 , 10 − 3 , 0 . 01 , 0 . 1 } , learning rates in { 10 − 4 , 10 − 3 } and choose the best performing model.
DynamicTriad (Zhou et al., 2018) was tuned using their two key hyper-parameters determining the effect of smoothness and triadic closure, β 0 and β 1 in the range { 0 . 01 , 0 . 1 , 1 , 10 } , as advised, while using recommended settings otherwise.
We use the L 1 operator ( | e tu − e tu | ) instead of Hadamard, as recommended in the paper, which also gives better performance.
For DynGEM, we tune the different scaling and regularization hyper-parameters, α ∈ { 10 − 6 , 10 − 5 } , β ∈ { 0 . 1 , 1 , 2 , 5 } , ν 1 ∈ { 10 − 6 , 10 − 4 } and ν 2 ∈ { 10 − 6 , 10 − 4 } , while using other default conﬁgurations.
G A DDITIONAL D ATASET D ETAILS
In this section, we provide some additional, relevant dataset details.
Since dynamic graphs often contain continuous timestamps, we split the data into multiple snapshots using suitable time-windows such each snapshot has an equitable yet reasonable number of interactions (communication/ratings).
In each snapshot, the weight of a link is determined by the number of interactions between the cor-
[Table]
responding pair of users during that time-period.
The pre-processed versions of all datasets will be made publicly available, along with the scripts used for processing the raw data.
Communication Networks.
The original un-processed Enron dataset is available at https: //www.cs.cmu.edu/˜./enron/ .
We use only the email communcations that are between
Enron employees, i.e. , sent by an Enron employee and have at least one recipient who is an Enron employee.
A time-window of 2 months is used to construct 16 snapshots, where the ﬁrst 5 are used as warm-up (due to sparsity) and the remaining 11 snapshots for evaluation.
The UCI dataset was downloaded from http://networkrepository.com/opsahl_ ucsocial.php .
This dataset contains private messages sent between users over a span of six months, on an online social network platform at the University of California, Irvine.
The snapshots are created using their communication history with a time-window of 10 days.
We discard/merge the terminal snapshots if they do not contain sufﬁcient communications.
Rating Networks.
We use the Round 11 version of the Yelp Dataset Challenge https://www.
yelp.com/dataset/challenge .
To extract a cohesive subset of user-business ratings, we ﬁrst select all businesses in the state of Arizona (the state with the largest number of ratings) with a selected set of restaurant categories.
Further, we ﬁlter the data to retain only users and business which have at-least 15 ratings.
Finally, we use a time-window of 6 months to extract 12 snapshots in the period of 2009 to 2015.
The ML-10m dynamic user-tag interaction network was downloaded from http:// networkrepository.com/ia-movielens-user2tags-10m.php .
This dataset depicts the tagging behavior of MovieLens users, with the tags applied by a user on her rated movies.
We use a time-window of 3 months to extract 13 snaphots over the course of 3 years.