Year: 2021

Abstract:
Learning to predict missing links is important for many graph-based applications. Existing methods were designed to learn the association between two sets of variables: (1) the observed graph structure (e.g., clustering effect) and (2) the existence of link between a pair of nodes. However, the causal relationship between these variables was ignored. We visit the possibility of learning it by asking a counterfactual question: “would the link exist or not if the observed graph structure became different?” To answer this question, we leverage causal models considering the information of the node pair (i.e., learned graph representations) as context, global graph structural properties as treatment, and link existence as outcome. In this work, we propose a novel link prediction method that enhances graph learning by counterfactual inference. It creates counterfactual links from the observed ones, and learns representations from both the observed and counterfactual links. Experiments on benchmark datasets show that this novel graph learning method achieves state-of-the-art performance on link prediction.

heading: 1 INTRODUCTION
text: Link prediction seeks to predict the likelihood of edge existence between node pairs based on the observed graph. Given the omnipresence of graph-structured data, link prediction has copious applications such as movie recommendation (Bennett et al., 2007), chemical interaction prediction (Stanfield et al., 2017), and knowledge graph completion (Kazemi & Poole, 2018). Graph machine learning methods have been widely applied to solve this problem. Their standard scheme is to first learn the representation vectors of nodes and then learn the association between the representations of a pair of nodes and the existence of the link between them. For example, graph neural networks (GNNs) use neighborhood aggregation to create the representation vectors: the representation vector of a node is computed by recursively aggregating and transforming representation vectors of its neighboring nodes (Kipf & Welling, 2016a; Hamilton et al., 2017; Wu et al., 2020). Then the vectors are fed into a binary classification model to learn the association. GNN methods have shown predominance in the task of link prediction (Kipf & Welling, 2016b; Zhang et al., 2020a).
Unfortunately, the causal relationship between graph structure and link existence was largely ignored in previous work. Existing methods that learn from association only were are not able to capture essential factors to accurately predict missing links in the test data. Take social network as an example. Suppose Alice and Adam live in the same neighborhood and they are close friends. The association between neighborhood belonging and friend closeness could be too strong to discover the essential factors of the friendship such as common interests or family relationship which could be the cause of being living in the same neighborhood. So, our idea is asking a counterfactual question: “would Alice and Adam still be close friends if they were not living in the same neighborhood?” If a graph learning model could learn the causal relationship by answering the counterfactual questions, it would improve the accuracy of link prediction with the novel knowledge it captured. Generally, the questions can be described as “would the link exist or not if the graph structure became different?”
As known to many, counterfactual question is a key component of causal inference and have been well defined in the literature. A counterfactual question is usually framed with three factors: context (as a data point), manipulation (e.g., treatment, intervention, action, strategy), and outcome (van der Laan & Petersen, 2007; Johansson et al., 2016). (To simplify the language, we use “treatment” to refer to the manipulation in this paper, as readers might be familiar more with the word “treatment.”)
Given certain data context, it asks what the outcome would have been if the treatment had not been the observed value. In the scenario of link prediction, we consider the information of a pair of nodes as context, graph structural properties as treatment, and link existence as outcome. Recall the social network example. The context is the representations of Alice and Adam that are learned from their personal attributes and relationships with others on the network. The treatment is living in the same neighborhood, which can be identified by community detection. And the outcome is their friendship. In this work, we present a counterfactual graph learning method for link prediction (CFLP) that trains graph learning models to answer the counterfactual questions. Figure 1 illustrates this twostep method. Suppose the treatment variable is defined as one type of global graph structure, e.g., the neighborhood assignment discovered by spectral clustering or community detection algorithms. We are wondering how likely the neighborhood distribution makes a difference on the link (non)existence for each pair of nodes. So, given a pair of nodes (like Alice and Adam) and the treatment value on this pair (in the same neighborhood), we find a pair of nodes (like Helen and Bob) that satisfies two conditions: (1) it has a different treatment (in different neighborhoods) and (2) it is the most similar pair with the given pair of nodes. We call these matched pair of nodes as “counterfactual links.” Note that the outcome of the counterfactual link can be either 1 or 0, depending on whether there exists an edge between the matched pair of nodes (Helen and Bob). The counterfactual link provides unobserved outcome to the given pair of nodes (Alice and Adam) under a counterfactual condition (in different neighborhoods). After counterfactual links are created for all (positive and negative) training examples, CFLP trains a link predictor (which can be GNN-based) to learn the representation vectors of nodes to predict both the observed factual links and the counterfactual links. In this Alice-Adam example, the link predictor is trained to estimate the individual treatment effect (ITE) of neighborhood assignment as 1 − 1 = 0, where ITE is a metric for the effect of treatment on the outcome and zero indicates the given treatment has no effect on the outcome. So, the learner will try to discover the essential factors on the friendship between Alice and Adam. CFLP leverages causal models to find these factors for graph learning models to accurately predict missing links.
Contributions. Our main contributions can be summarized as follows. (1) This is the first work that proposes to improve link prediction by causal inference, specifically, learning to answer counterfactual questions about link existence. (2) This work introduces CFLP that trains GNN-based link predictors to predict both factual and counterfactual links. It learns the causal relationship between global graph structure and link existence. (3) CFLP outperforms competitive baseline methods on several benchmark datasets. We analyze the impact of counterfactual links as well as the choice of treatment variable. This work sheds insights for improving graph machine learning with causal analysis, which has not been extensively studied yet, when the other direction (machine learning for causal inference) has been studied for a long time.

heading: 2 PROBLEM DEFINITION
text: Notations Let G = (V, E) be an undirected graph of N nodes, where V = {v1, v2, . . . , vN} is the set of nodes and E ⊆ V × V is the set of observed links. We denote the adjacency matrix as
A ∈ {0, 1}N×N , whereAi,j = 1 indicates nodes vi and vj are connected and vice versa. We denote the node feature matrix as X ∈ RN×F , where F is the number of node features and xi (bolded) indicates the feature vector of node vi (the i-th row of X).
In this work, we follow the commonly accepted problem definition of link prediction on graph data (Zhang & Chen, 2018; Zhang et al., 2020a; Cai et al., 2021): Given an observed graph G (with validation and testing links masked off), predict the link existence between every pair of nodes. More specifically, for the GNN-based link prediction methods, they learn low-dimensional node representations Z ∈ RN×H , where H is the dimensional size of latent space such that H F , and then use Z for the prediction of link existence.

heading: 3 PROPOSED METHOD
text: 3.1 IMPROVING GRAPH LEARNING WITH CAUSAL MODEL Z
?T
Y
Z?
T
Y
Treatment Effect Estimation
Graph Representation Learning
Figure 2: Causal modeling (not the target of our work but related to the idea we propose): Given Z and observed outcomes, find treatment effect of T on Y .
Z
?T
Y
Z?
T
Y
Treatment Effect Estimation
Graph Representation Learning
Figure 3: Graph learning with causal model (the proposed idea): leverage the estimated ATE(Y |T ) to improve the learning of Z.
Leveraging Causal Model(s) Counterfactual causal inference aims to find out the causal relationship between treatment and outcomes by asking the counterfactual questions such as ”would the outcome be different if the treatment was different?” (Morgan & Winship, 2015). Figure 2 is a typical example, in which we denote the context (confounder) as Z, treatment as T , and the outcome as Y . Given the context, treatments, and their corresponding outcomes, counterfactual inference methods aim to find the effect of treatment on the outcome, which is usually measured by individual treatment effect (ITE) and its expectation averaged treatment effect (ATE) (van der Laan & Petersen, 2007; Weiss et al., 2015). For a binary treatment variable T = {0, 1}, denoting g(z, T ) as the outcome of z given the treatment T , we have ITE(z) = g(z, 1)− g(z, 0), and ATE = Ez∼Z ITE(z). Ideally, we need all possible outcomes of the contexts under all kinds of treatments to study the causal relationships (Morgan & Winship, 2015). However, in reality, the fact that we can only observe one potential outcome under one particular treatment prevents the ITE from being known (Johansson et al., 2016). Traditional causal inference methods use statisti-
cal learning approaches such as Neyman–Rubin casual model (BCM) and propensity score matching (PSM) to predict the value of ATE (Rubin, 1974; 2005).
In this work, we look at link prediction with graph learning, which is essentially learning the best node representations Z for the prediction of link existence. Therefore, as shown in Figure 3, where the outcome Y is the link existence, the objective is different from classic causal inference. In graph learning, we can estimate the effect of treatment on the outcome (ATE(Y |T )), and we want to improve the learning of Z with the estimation. More specifically, in graph learning for link prediction, for each pair of nodes (vi, vj), its ITE can be estimated with
ITE(vi,vj) = g((zi, zj), 1)− g((zi, zj), 0) (1) and we use this information to improve the learning of Z, i.e., P (Z|Y ). We denote the observed adjacency matrix as the factual outcomes A and the unobserved adjacency matrix when the treatment is different as the counterfactual outcomes ACF . We denote T ∈ {0, 1}N×N as the binary factual treatment matrix, where Ti,j indicates the treatment of the node pair (vi, vj). We denote TCF as the counterfactual treatment matrix where TCFi,j = 1 − Ti,j . We are interested in (1) estimating the counterfactual outcomes ACF via observed data, (2) learning with the counterfactual adjacency matrix ACF to enhance link prediction, and (3) learning the causal relationship between graph structural information (treatment) and link existence (outcome).
Treatment Variable Previous work on graph machine learning (Velickovic et al., 2019; Park et al., 2020) showed that the graph’s global structural information could improve the quality of representation vectors of nodes learned by GNNs. This is because the message passing-based GNNs aggregate
local information in the algorithm of representation vector generation and the global structural information is complementary with the aggregated information. Therefore, for a pair of nodes, one option of defining the treatment variable is its global structural role in the graph. Without the loss of generality, we use Louvain (Blondel et al., 2008), an unsupervised approach that has been widely used for community detection, as an example. Louvain discovers community structure of a graph and assigns each node to one community. Then we can define the binary treatment variable as whether these two nodes in the pair belong to the same community. Let c : V → N be any graph mining/clustering method that outputs the index of community/cluster/neighborhood that each node belongs to. The treatment matrix T is defined as Ti,j = 1 if c(vi) = c(vj), and Ti,j = 0 otherwise. For the choice of c, we suggest methods that group nodes based on global graph structural information, including but not limited to Louvain (Blondel et al., 2008), K-core (Bader & Hogue, 2003), and spectral clustering (Ng et al., 2001).

heading: 3.2 COUNTERFACTUAL LINKS
text: To implement the solution based on above idea, we propose counterfactual links. As aforementioned, for each node pair, the observed data contains only the factual treatment and outcome, meaning that the link existence for the given node pair with an opposite treatment is unknown. Therefore, we use the outcome from the nearest observed context as a substitute. This type of matching on covariates is widely used to estimate treatment effects from observational data (Johansson et al., 2016; Alaa & Van Der Schaar, 2019). That is, we want to find the nearest neighbor with the opposite treatment for each observed node pairs and use the nearest neighbor’s outcome as a counterfactual link. Formally, ∀(vi, vj) ∈ V × V , we want to find its counterfactual link (va, vb) as below:
(va, vb) = arg min va,vb∈V
{h((vi, vj), (va, vb)) | Ta,b = 1− Ti,j}, (2)
where h(·, ·) is a metric of measuring the distance between a pair of node pairs (a pair of contexts). Nevertheless, finding the nearest neighbors by computing the distance between all pairs of node pairs is extremely inefficient and infeasible in application, which takes O(N4) comparisons (as there are totally O(N2) node pairs). Hence we implement Eq. (2) using node-level embeddings. Specifically, considering that we want to find the nearest node pair based on not only the raw node features but also structural features, we take the state-of-the-art unsupervised graph representation learning method MVGRL (Hassani & Khasahmadi, 2020) to learn the node embeddings X̃ ∈ RN×F̃ from the observed graph (with validation and testing links masked off). We use X̃ to find the nearest neighbors of node pairs. Therefore, ∀(vi, vj) ∈ V × V , we define its counterfactual link (va, vb) as
(va, vb) = arg min va,vb∈V
{d(x̃i, x̃a) + d(x̃j , x̃b) | Ta,b = 1− Ti,j , d(x̃i, x̃a) + d(x̃j , x̃b) < 2γ}, (3)
where d(·, ·) is specified as the Euclidean distance on the embedding space of X̃, and γ is a hyperparameter that defines the maximum distance that two nodes are considered as similar. When no node pair satisfies the above equation (i.e., there does not exist any node pair with opposite treatment that is close enough to the target node pair), we do not assign any nearest neighbor for the given node pair to ensure all the neighbors are similar enough (as substitutes) in the feature space. Thus, the counterfactual treatment matrix TCF and the counterfactual adjacency matrix ACF are defined as
TCFi,j , A CF i,j = { 1− Ti,j , Aa,b , if ∃ (va, vb) ∈ V × V satisfies Eq. (3); Ti,j , Ai,j , otherwise.
(4)
It is worth noting that the node embeddings X̃ and the nearest neighbors are computed only once and do not change during the learning process. X̃ is only used for finding the nearest neighbors. We also note that X̃ must be structural embeddings rather than positional embeddings (as defined in (Srinivasan & Ribeiro, 2020)).
Learning from Counterfactual Distributions Let PF be the factual distribution of the observed contexts and treatments, and PCF be the counterfactual distribution that is composed of the observed contexts and opposite treatments. We define the empirical factual distribution P̂F ∼ PF as P̂F = {(vi, vj , Ti,j)}Ni,j=1, and define the empirical counterfactual distribution P̂CF ∼ PCF as P̂CF = {(vi, vj , TCFi,j )}Ni,j=1. Unlike traditional link prediction methods that take only P̂F as input and use the observed outcomes A as the training target, the idea of counterfactual graph learning is to take advantage of the counterfactual distribution by having P̂CF as a complementary input and use the counterfactual outcomes ACF as the training target for the counterfactual data samples.

heading: 3.3 THE COUNTERFACTUAL GRAPH LEARNING MODEL
text: In this subsection, we present the design of our model as well as the training method. The input of the model in CFLP includes (1) the observed graph data A and raw feature matrix X, (2) the factual treatments TF and counterfactual treatments TCF , and (3) the counterfactual graph data ACF . The output contains link prediction logits in Â and ÂCF for the factual and counterfactual adjacency matrices A and ACF , respectively.
Graph Learning Model The model consist of two trainable components: a graph encoder f and a link decoder g. The graph encoder generates representation vectors of nodes from graph data G. And the link decoder projects the representation vectors of node pairs into the link prediction logits. The choice of the graph encoder f can be any end-to-end GNN model. Without the loss of generality, here we use the commonly used graph convolutional network (GCN) (Kipf & Welling, 2016a). Each layer of GCN is defined as
H(l) = f (l)(A,H(l−1);W(l)) = σ(D̃− 1 2 ÃD̃− 1 2H(l−1)W(l)), (5)
where l is the layer index, Ã = A + I is the adjacency matrix with added self-loops, D̃ is the diagonal degree matrix D̃ii = ∑ j Ãij , H
(0) = X, W(l) is the learnable weight matrix at the l-th layer, and σ(·) denotes a nonlinear activation such as ReLU. We denote Z = f(A,X) ∈ RN×H as the output from the encoder’s last layer, i.e., the H-dimensional representation vectors of nodes. Following previous work (Zhang et al., 2020a), we compute the representation of a node pair as the Hadamard product of the vectors of the two nodes. That is, the representation for the node pair (vi, vj) is zi zj ∈ RH , where stands for the Hadamard product. For the link decoder that predicts whether a link exists between a pair of nodes, we opt for simplicity and adopt a simple decoder based on multi-layer perceptron (MLP), given the representations of node pairs and their treatments. That is, the decoder g is defined as
Â = g(Z,T), where Âi,j = MLP([zi zj , Ti,j ]), (6)
ÂCF = g(Z,TCF ), where ÂCFi,j = MLP([zi zj , TCFi,j ]), (7)
where [·, ·] stands for the concatenation of vectors, and Â and ÂCF can be used for estimating the observed ITE as aforementioned in Eq. (1).
During the training process, data samples from the empirical factual distribution P̂F and the empirical counterfactual distribution P̂CF are fed into decoder g and optimized towards A and ACF , respectively. That is, for the two distributions, the loss functions are as follows:
LF = 1
N2 N∑ i=1 N∑ j=1 Ai,j · log Âi,j + (1−Ai,j) · log(1− Âi,j), (8)
LCF = 1
N2 N∑ i=1 N∑ j=1 ACFi,j · log ÂCFi,j + (1−ACFi,j ) · log(1− ÂCFi,j ). (9)
Balancing Counterfactual Learning In the training process, the above loss minimizations train the model on both the empirical factual distribution P̂F ∼ PF and empirical counterfactual distribution P̂CF ∼ PCF that are not necessarily equal – the training examples (node pairs) do not have to be aligned. However, at the stage of inference, the test data contains only observed (factual) samples. Such a gap between the training and testing data distributions exposes the model in the risk of covariant shift, which is a common issue in counterfactual learning (Johansson et al., 2016; Assaad et al., 2021).
To force the distributions of representations of factual distributions and counterfactual distributions to be similar, we use the discrepancy distance (Mansour et al., 2009; Johansson et al., 2016) as another objective to regularize the representation learning. That is, we use the following loss term to minimize the distance between the learned representations from P̂F and P̂CF :
Ldisc = disc(P̂Ff , P̂CFf ), where disc(P,Q) = ||P −Q||F , (10)
where || · ||F denotes the Frobenius Norm, and P̂Ff and P̂CFf denote the node pair representations learned by graph encoder f from factual distribution and counterfactual distribution, respectively. That is, the learned representations for (vi, vj , Ti,j) and (vi, vj , TCFi,j ) are [zi zj , Ti,j ] (Eq. (6)) and [zi zj , TCFi,j ] (Eq. (7)), respectively.
Training During the training of CFLP, we want the model to be optimized towards three targets: (1) accurate link prediction on the observed outcomes (Eq. (8)), (2) accurate estimation on the counterfactual outcomes (Eq. (9)), and (3) regularization on the representation spaces learned from P̂F
and P̂CF (Eq. (10)). Therefore, the overall training loss of our proposed CFLP is
L = LF + α · LCF + β · Ldisc, (11)
where α and β are hyperparameters to control the weights of counterfactual outcome estimation (link prediction) loss and discrepancy loss.
Algorithm 1: CFLP: Counterfactual graph learning for link prediction Input : f , g, A, X, n epochs, n epoch ft 1 Compute T as presented in Section 3.1 ; 2 Compute TCF ,ACF by Eqs. (3) and (4) ; /* model training */ 3 Initialize Θf in f and Θg in g ; 4 for epoch in range(n epochs) do 5 Z = f(A,X) ; 6 Get Â and ÂCF via g with Eqs. (6) and (7) ; 7 Update Θf and Θg with L ; // Eq. (11) 8 end /* decoder fine-tuning */
9 Freeze Θf and re-initialize Θg ; 10 Z = f(A,X) ; 11 for epoch in range(n epochs ft) do 12 Get Â via g with Eq. (6) ; 13 Update Θg with LF ; // Eq. (8) 14 end /* model inferencing inference */ 15 Z = f(A,X) ; 16 Get Â and ÂCF via g with Eqs. (6) and (7) ;
Output: Â for link prediction, ÂCF
Summary Algorithm 1 summarizes the whole process of CFLP. The first step is to compute the factual and counterfactual treatments T, TCF as well as the counterfactual outcomes ACF . Then, the second step trains the graph learning model on both the observed factual data and created counterfactual data with the integrated loss function (Eq. (11)). Note that the discrepancy loss (Eq. (10)) is computed on the representations of node pairs learned by the graph encoder f , so the decoder g is trained with data from both P̂F and P̂CF without balancing the constraints. Therefore, after the model is sufficiently trained, we freeze the graph encoder f and fine-tune g with only the factual data. Finally, after the decoder is sufficiently finetuned, we output the link prediction logits for both the factual and counterfactual adjacency matrices.
Complexity The complexity of the first step (finding counterfactual links with nearest neighbors) is proportional to the number of node pairs. When γ is set as a small value to obtain indeed similar node pairs, this step (Eq. (3)) uses constant time. Moreover, the computation in Eq. (3) can be parallelized. Therefore, the time complexity is O(N2/C) where C is the number of processes. For the complexity of the second step (training counterfactual learning model), the GNN encoder has time complexity of O(LH2N +LH|E|) (Wu et al., 2020), where L is the number of GNN layers and H is the size of node representations. Given that we sample the same number of non-existing links as that of observed links during training, the complexity of a three-layer MLP decoder is O(((H + 1) · dh + dh · 1)|E|) = O(dh(H + 2)|E|), where dh is the number of neurons in the hidden layer. Therefore, the second step has linear time complexity w.r.t. the sum of node and edge counts.
Limitations First, as mentioned above, the computation of finding counterfactual links has a worst-case complexity of O(N2). Second, CFLP performs counterfactual prediction with only a single treatment; however, there are quite a few kinds of graph structural information that can be considered as treatments. Future work can leverage the rich structural information by bundled treatments (Zou et al., 2020) in counterfactual graph learning.

heading: 4 EXPERIMENTS

heading: 4.1 EXPERIMENTAL SETUP
text: We conduct experiments on five benchmark datasets including citation networks (CORA, CITESEER, PUBMED (Yang et al., 2016)), social network (FACEBOOK (McAuley & Leskovec, 2012)), and drug-drug interaction network (OGB-DDI (Wishart et al., 2018)) from the Open Graph Benchmark (OGB) (Hu et al., 2020). For the first four datasets, we randomly select 10%/20% of the links and the same numbers of disconnected node pairs as validation/test samples. The links in the validation and test sets are masked off from the training graph. For OGB-DDI, we used the OGB official train/validation/test splits. Statistics and details for the datasets are given in Appendix. We use K-core (Bader & Hogue, 2003) clusters as the default treatment variable. We evaluate CFLP on three commonly used GNN encoders: GCN (Kipf & Welling, 2016a), GSAGE (Hamilton et al., 2017), and JKNet (Xu et al., 2018). We compare the link prediction performance of CFLP against Node2Vec (Grover & Leskovec, 2016), MVGRL (Hassani & Khasahmadi, 2020), VGAE (Kipf & Welling, 2016b), SEAL (Zhang & Chen, 2018), LGLP (Cai et al., 2021), and GNNs with MLP decoder. We report averaged test performance and their standard deviation over 20 runs with different random parameter initializations. Other than the most commonly used of Area Under ROC Curve (AUC), we report Hits@20 (one of the primary metrics on OGB leaderboard) as a more challenging metric, as it expects models to rank positive edges higher than nearly all negative edges.
Besides performance comparison on link prediction, we will answer two questions to suggest a way of choosing a treatment variable for creating counterfactual links: (Q1) Does CFLP sufficiently learn the observed averaged treatment effect (ATE) derived from the counterfactual links? (Q2) What is the relationship between the estimated ATE learned in the method and the prediction performance? If the answer to Q1 is yes, then the answer to Q2 will indicate how to choose treatment based on observed ATE. To answer the Q1, we calculate the observed ATE (ÂTEobs) by comparing the observed links in A and created counterfactual links ACF that have opposite treatments. And we calculate the estimated ATE (ÂTEest) by comparing the predicted links in Â and predicted counterfactual links ÂCF . Formally, ÂTEobs and ÂTEest are defined as
ÂTEobs = 1
N2 N∑ i=1 N∑ j=1 {T (A−ACF ) + (1N×N −T) (ACF −A)}i,j . (12)
ÂTEest = 1
N2 N∑ i=1 N∑ j=1 {T (Â− ÂCF ) + (1N×N −T) (ÂCF − Â)}i,j . (13)
The treatment variables we will investigate are usually graph clustering or community detection methods, such as K-core (Bader & Hogue, 2003), stochastic block model (SBM) (Karrer & Newman, 2011), spectral clustering (SpecC) (Ng et al., 2001), propagation clustering (PropC) (Raghavan et al., 2007), Louvain (Blondel et al., 2008), common neighbors (CommN), Katz index, and hierarchical clustering (Ward) (Ward Jr, 1963). We use JKNet (Xu et al., 2018) as default graph encoder.
Implementation details and supplementary experimental results (e.g., sensitivity on γ, ablation study on LCF and Ldisc) can be found in Appendix. Source code is available in supplementary material.

heading: 4.2 EXPERIMENTAL RESULTS
text: Link Prediction Tables 1 and 2 show the link prediction performance of Hits@20 and AUC by all methods. LGLP on PUBMED and OGB-DDI are missing due to the out of memory error when running the code package from the authors. We observe that our CFLP on different graph encoders achieve similar or better performances compared with baselines. The only exception is the AUC on FACEBOOK where most methods have close-to-perfect AUC. As AUC is a relatively easier metric comparing with Hits@20, most methods achieved good performance on AUC. We observe that CFLP with JKNet almost consistently achieves the best performance and outperforms baselines significantly on Hits@20. Specifically, comparing with the best baseline, CFLP improves relatively by 16.4% and 0.8% on Hits@20 and AUC, respectively. Comparing with the best performing baselines, which are also GNN-based, CFLP benefits from learning with both observed link existence (A) and our defined counterfactual links (ACF ).
ATE with Different Treatments Tables 3 and 4 show the link prediction performance, ÂTEobs, and ÂTEest of CFLP (with JKNet) when using different treatments. The treatments in Tables 3 and 4 are sorted by the Hits@20 performance. Bigger ATE indicates stronger causal relationship between the treatment and outcome, and vice versa. We observe: (1) the rankings of ÂTEest and ÂTEobs are positively correlated with Kendell’s ranking coefficient (Abdi, 2007) of 0.67 and 0.57 for CORA and CITESEER, respectively. Hence, CFLP was sufficiently trained to learn the causal relationship between graph structure information and link existence; (2) ÂTEobs and ÂTEest are both negatively correlated with the link prediction performance, showing that we can pick a proper treatment prior to training a model with CFLP. Using the treatment that has the weakest causal relationship with link existence is likely to train the model to capture more essential factors on the outcome, in a way similar to denoising the unrelated information from the representations.

heading: 5 RELATED WORK
text: Link Prediction With its wide applications, link prediction has draw attention from many research communities including statistical machine learning and data mining. Stochastic generative methods based on stochastic block models (SBM) are developed to generate links (Mehta et al., 2019). In data mining, matrix factorization (Menon & Elkan, 2011), heuristic methods (Philip et al., 2010; Martı́nez et al., 2016), and graph embedding methods (Cui et al., 2018) have been applied to predict links in the graph. Heuristic methods compute the similarity score of nodes based on their neighborhoods. These methods can be generally categorized into first-order, second-order, and high-order heuristics based on the maximum distance of the neighbors. Graph embedding methods learn latent node features via embedding lookup and use them for link prediction (Perozzi et al., 2014; Tang et al., 2015; Grover & Leskovec, 2016; Wang et al., 2016). In the past few years, GNNs have showed promising results on various graph-based tasks with their ability of learning from features and custom aggregations on structures (Kipf & Welling, 2016a; Hamilton et al., 2017; Wu et al., 2020)(Cotta et al., 2021). With node pair representations and an attached MLP or inner-product decoder, GNNs can be used for link prediction (Zhang et al., 2020a; Davidson et al., 2018; Yang et al., 2018). For example, VGAE used GCN to learn node representations and reconstruct the graph structure (Kipf & Welling, 2016b). SEAL extracted a local subgraph around each target node pair and then learned graph representation from local subgraph for link prediction (Zhang & Chen, 2018). Following the scheme of SEAL, Cai & Ji (2020) proposed to improve local subgraph representation learning by multi-scale graph representation learning. And LGLP inverted the local subgraphs to line graphs before learning representations (Cai et al., 2021). However, very limited work has studied to use causal inference for improving link prediction. Counterfactual Prediction As a mean of learning the causality between treatment and outcome, counterfactual prediction has been used for a variety of applications such as recommender systems (Wang et al., 2020; Xu et al., 2020), health care (Alaa & van der Schaar, 2017; Pawlowski et al., 2020), vision-language tasks (Zhang et al., 2020b; Parvaneh et al., 2020), and decision making (Coston et al., 2020; Pitis et al., 2020; Kusner et al., 2017). To infer the causal relationships, previous work usually estimated the ITE via function fitting models (Gelman & Hill, 2006; Chipman et al., 2010; Wager & Athey, 2018; Assaad et al., 2021). Peysakhovich et al. (2019) and Zou et al. (2020) studied counterfactual prediction with multiple agents and bundled treatments, respectively. Causal Inference Causal inference methods usually re-weighted samples based on propensity score (Rosenbaum & Rubin, 1983; Austin, 2011) to remove confounding bias from binary treatments. Recently, several works studied about learning treatment invariant representation to predict the counterfactual outcomes (Shalit et al., 2017; Li & Fu, 2017; Yao et al., 2018; Yoon et al., 2018; Hassanpour & Greiner, 2019a;b; Bica et al., 2020). Few recent works combined causal inference with graph learning (Sherman & Shpitser, 2020; Bevilacqua et al., 2021; Lin et al., 2021; Feng et al., 2021). For example, Sherman & Shpitser (2020) proposed a new concept in causal modeling, called “network intervention”, to study the effect of link creation on network structure changes. Bevilacqua et al. (2021) studied the task of out-of-distribution (OOD) graph classification, and showed how subgraph densities can be used to build size-invariant graph representations, which alleviates the train-test gap when learning from OOD data.

heading: 6 CONCLUSION AND FUTURE WORK
text: In this work, we presented a counterfactual graph learning method for link prediction (CFLP). We introduced the idea of counterfactual prediction to improve link prediction on graphs. CFLP accurately predicted the missing links by exploring the causal relationship between global graph structure and link existence. Extensive experiments demonstrated that CFLP achieved the state-of-the-art performance on benchmark datasets. This work sheds insights that a good use of causal models (even basic ones) can greatly improve the performance of (graph) machine learning tasks, which in our case is link prediction. We note that the use of more sophistically designed causal models may lead to larger improvements for other machine learning tasks, which could be a valuable future research direction for the community. Other than our use of global graph structure as treatment, other treatments choices (with both empirical and theoretical analyses) are also worth exploring. Moreover, as CFLP first generates counterfactual links and then learns from both observed and counterfactual link existence, the underlying philosophy of our methodology could be considered as graph data augmentation. Therefore, investigating the relationship between counterfactual graph learning and graph data augmentation is also a possible future research direction.

heading: A ADDITIONAL DATASET DETAILS
text: In this section, we provide some additional dataset details. All the datasets used in this work are publicly available. Statistics for the datasets are shown in Table 5.
Citation Networks CORA, CITESEER, and PUBMED are citation networks that were first used by Yang et al. (2016) and then commonly used as benchmarks in GNN-related literature (Kipf & Welling, 2016a; Veličković et al., 2017). In these citation networks, the nodes are published papers and features are bag-of-word vectors extracted from the corresponding paper. Links represent the citation relation between papers. We loaded the datasets with the DGL1 package.
Social Network The FACEBOOK dataset2 is a social network constructed from friends lists from Facebook (McAuley & Leskovec, 2012). The nodes are Facebook users and links indicate the friendship relation on Facebook. The node features were constructed from the user profiles and anonymized by McAuley & Leskovec (2012).
Drug-Drug Interaction Network The OGB-DDI dataset was constructed from a public Drug database (Wishart et al., 2018) and provided by the Open Graph Benchmark (OGB) (Hu et al., 2020). Each node in this graph represents an FDA-approved or experimental drug and edges represent the existence of unexpected effect when the two drugs are taken together. This dataset does not contain any node features, and it can be downloaded with the dataloader3 provided by OGB.

heading: B EXPANDED RELATED WORK
text: With the rapid development of graph machine learning in the past few years, researchers have been attempting to relate graph neural networks (GNNs) with causal models. Recently, several works have been proposed to improve graph learning with causal models (Sherman & Shpitser, 2020; Bevilacqua et al., 2021; Lin et al., 2021; Feng et al., 2021). Sherman & Shpitser (2020) proposed a new concept in causal modeling, called “network intervention”, that is a type of structural intervention in network contexts. Sherman & Shpitser (2020) modeled social network with causal DAG and studied the effect of network intervention (link creation and removal) on network structure changes. Lin et al. (2021) formulated the problem of post-hoc explanation generation for GNNs as a causal learning task and proposed a causal explanation model with a loss designed based on Granger causality. Feng et al. (2021) formulated node classification of GNNs with a causal DAG, which estimated the causal effect of the local structure on the prediction and adaptively chose whether to aggregate from the neighbors. Bevilacqua et al. (2021) studied the task of out-of-distribution (OOD) graph classification, and showed how subgraph densities can be used to build size-invariant graph representations. They modeled OOD graph classification with a twin network DAG causal model, which learned approximately environment-invariant graph representations that better extrapolate between train and test data. The last three works, i.e., Lin et al. (2021), Feng et al. (2021), Bevilacqua et al. (2021), proposed to use causal models to improve the performance of three different types of graph machine learning tasks such as GNN explanation (subgraph) generation, node-level classification,
1https://github.com/dmlc/dgl 2https://snap.stanford.edu/data/ego-Facebook.html 3https://ogb.stanford.edu/docs/linkprop/#data-loader
and graph-level classification. Compared with them, our work has three points of uniqueness. First, to the best of our knowledge, our work makes the first attempt to use causal model to improve the performance of link prediction which is also an important graph learning task. Second, to make the attempt successful, our work presents a novel concept of “counterfactual link” and proposes a novel method CFLP that learns from both factual and counterfactual link existence. Third, the proposed method CFLP is flexible with the choice of treatment variables and is able to suggest good treatment choices prior to training via ÂTEobs.

heading: C DETAILS ON IMPLEMENTATION AND HYPERPARAMETERS
text: All the experiments in this work were conducted on a Linux server with Intel Xeon Gold 6130 Processor (16 Cores @2.1Ghz), 96 GB of RAM, and 4 RTX 2080Ti cards (11 GB of RAM each). Our method are implemented with Python 3.8.5 with PyTorch. Source code is available in the supplementary materials. A list of used packages can be found in requirements.txt.
Baseline Methods For baseline methods, we use official code packages from the authors for MVGRL4 (Hassani & Khasahmadi, 2020), SEAL5 (Zhang & Chen, 2018), and LGLP6 (Cai et al., 2021). We use a public implementation for VGAE7 (Kipf & Welling, 2016b) and OGB implementations8 for Node2Vec and baseline GNNs. For fair comparison, we set the size of node/link representations to be 256 of all methods.
CFLP We use the Adam optimizer with a simple cyclical learning rate scheduler (Smith, 2017), in which the learning rate waves cyclically between the given learning rate (lr) and 1e-4 in every 70 epochs (50 warmup steps and 20 annealing steps). We implement the GNN encoders with torch_geometric9 (Fey & Lenssen, 2019). Same with the baselines, we set the size of all hidden layers and node/link representations of CFLP as 256. The graph encoders all have three layers and JKNet has mean pooling for the final aggregation layer. The decoder is a 3-layer MLP with a hidden layer of size 64 and ELU as the nonlinearity. As the Euclidean distance used in Eq. (3) has a range of [0,∞), the value of γ depends on the distribution of all-pair node embedding distances, which varies for different datasets. Therefore, we set the value of γ as the γpct-percentile of all-pair node embedding distances. Commands for reproducing the experiments are included in README.md.
Hyperparameter Searching Space We manually tune the following hyperparameters over range: lr ∈ {0.005, 0.01, 0.05, 0.1, 0.2}, α ∈ {0.001, 0.01, 0.1, 1, 2}, β ∈ {0.001, 0.01, 0.1, 1, 2}, γpct ∈ {10, 20, 30}.
Treatments For the graph clustering or community detection methods we used as treatments, we use the implementation from scikit-network10 for Louvain (Blondel et al., 2008), SpecC (Ng et al., 2001), PropC (Raghavan et al., 2007), and Ward (Ward Jr, 1963). We used implementation of K-core (Bader & Hogue, 2003) from networkx.11 We used SBM (Karrer & Newman, 2011) from a public implementation by Funke & Becker (2019).12 For CommN and Katz, we set Ti,j = 1 if the number of common neighbors or Katz index between vi and vj are greater or equal to 2 or 2 times the average of all Katz index values, respectively. For SpecC, we set the number of clusters as 16. For SBM, we set the number of communities as 16. These settings are fixed for all datasets.
4https://github.com/kavehhassani/mvgrl 5https://github.com/facebookresearch/SEAL_OGB 6https://github.com/LeiCaiwsu/LGLP 7https://github.com/DaehanKim/vgae_pytorch 8https://github.com/snap-stanford/ogb/tree/master/examples/
linkproppred/ddi 9https://pytorch-geometric.readthedocs.io/en/latest/
10https://scikit-network.readthedocs.io/ 11https://networkx.org/documentation/ 12https://github.com/funket/pysbm

heading: D ADDITIONAL EXPERIMENTAL RESULTS AND DISCUSSIONS
text: Link Prediction Tables 6 and 7 show the link prediction performance of Hits@50 and Average Precision (AP) by all methods. LGLP on PUBMED and OGB-DDI are missing due to the out of memory error when running the code package from the authors. Similar to the results in Tables 1 and 2, we observe that our CFLP on different graph encoders achieve similar or better performances compared with baselines, with the only exception of AP on FACEBOOK where most methods have close-to-perfect AP. From Tables 1, 2, 6 and 7, we observe that CFLP achieves improvement over all GNN architectures (averaged across datasets). Specifically, CFLP improves 25.6% (GCN), 12.0% (GSAGE), and 36.3% (JKNet) on Hits@20, 9.6% (GCN), 5.0% (GSAGE), and 17.8% (JKNet) on Hits@50, 5.6% (GCN), 1.6% (GSAGE), and 1.9% (JKNet) on AUC, and 0.8% (GCN), 0.8% (GSAGE), and 1.8% (JKNet) on AP. We note that CFLP with JKNet almost consistently achieves the best performance and outperforms baselines significantly on Hits@50. Specifically, compared with the best baseline, CFLP improves relatively by 6.8% and 0.9% on Hits@50 and AP, respectively.
Ablation Study on Losses For the ablative studies of LCF (Eq. (9)) and Ldisc (Eq. (10)), we show their effect by removing them from the integrated loss function (Eq. (11)). Table 8 shows the results of CFLP on CORA and CITESEER under different settings (α = 0, β = 0, α = β = 0, and original setting). We observe that CFLP in the original setting achieves the best performance. The performance drops significantly when having α = 0, i.e., not using any counterfactual data during training. We note that having β = 0, i.e., not using the discrepancy loss, also lowers the performance. Therefore, both LCF and Ldisc are essential for improving the link prediction performance.
Ablation Study on Node Embedding X̃ As the node embedding X̃ is used in the early step of CFLP for finding the counterfactual links, the quality of X̃ may affect the later learning process. Therefore, we also evaluate CFLP with different state-of-the-art unsupervised graph representation learning methods: MVGRL (Hassani & Khasahmadi, 2020), DGI (Velickovic et al., 2019), and GRACE (Zhu et al., 2020). Table 9 shows the link prediction performance of CFLP (w/ JKNet) on CORA and CITESEER with different node embeddings. We observe that the choice of the method for learning X̃ does have an impact on the later learning process as well as the link prediction performance. Nevertheless, Table 9 shows CFLP’s advantage can be consistently observed with different choices of methods for learning X̃, as CFLP with X̃ learned from all three methods showed promising link prediction performance.
Sensitivity Analysis of α and β Figure 4 shows the AUC performance of CFLP on CORA with different combinations of α and β. We observe that the performance is the poorest when α = β = 0 and gradually improves and gets stable as α and β increase, showing that CFLP is generally robust to the hyperparameters α and β, and the optimal values are easy to locate.
Sensitivity Analysis of γ Figure 5 shows the Hits@20 and AUC performance on link prediction of CFLP (with JKNet) on CORA and CITESEER with different treatments and γpct. We observe that the performance is generally good when 10 ≤ γpct ≤ 20 and gradually get worse when the value of γpct is too small or too large, showing that CFLP is robust to γ and the optimal γ is easy to find.
Sensitivity to Noisy Data We note that robustness w.r.t. noisy data is not within our claim of technical contributions. Nevertheless, CFLP is not more vulnerable than other link prediction baselines. We conduct experiments with random attacks on the Cora dataset (randomly removing links and adding noisy links). Table 10 shows the AUC performances of our proposed CFLP (w/ JKNet) compared to the strongest baseline methods under different levels of random attacks (0%, 2%, 5%, and 10%). We can observe that as the attack strength goes up, the link prediction performance of all methods go down. We also note that our proposed CFLP still outperforms the baseline methods.
Generalization to Graphs with Weighted Edges As our proposed CFLP uses GNN as the graph encoder and GNNs are usually able to take weighted graph as input (e.g., the adjacency matrix A for GCN can be weighted), the model should be able to handle weighted graphs as given. Note the link prediction losses (Eqs. (8) and (9)) need to be slightly modified considering the task. When the task is to predict the link existence, the label adjacency matrix used in Eqs. (8) and (9) must be of binary values. When the task is to predict the link weights, the BCE loss functions (Eqs. (8) and (9)) need to be changed to regression loss functions such as MSE.

Review summaries:
This paper introduces the idea of counterfactual prediction to improve link prediction on graphs and proposes a framework, counterfactual graph learning method for link prediction (CFLP). Specifically, the authors first introduce a method of generating counterfactual samples and then utilize these new data as well as original factual data to train the proposed model. The proposed method outperforms competitive baseline methods on several benchmark datasets in the link prediction task. The authors also provide sensitivity analysis and examine the impact of different treatments (i.e., results from different community detection algorithms) to link prediction results.

The authors propose a model for link prediction that takes into account the counterfactuals. The main idea is to learn an embedding of the nodes and then use that embedding to train a classifier model for link prediction. The key part is that the embedding is learned in such a way as to minimize the discrepancy between the factual and counterfactual distributions. Experiments of various commonly-used datasets show that the proposed method results in improved link prediction performance compared to state-of-the-art methods.

The paper consider the task of counterfactually predicting edges in attributed graphs. I think this is a good effort (but incomplete) in a consequential and fast growing area. The paper needs to define the counterfactual task formally and prove their approach really does what the paper claim it does.

In this paper, the authors consider a link prediction problem utilizing the idea of causal inference. To find the essential factors between nodes, they make counterfactual links using a matching-like algorithm for pairs of nodes. A GNN-based model is trained to learn representations so that the model can predict both the factual and counterfactual links. In training, first they jointly optimize the entire loss function including the counterfactual loss and the balancing loss, and then they fix the encoder and only train the decoder using the factual data. In the link prediction experiment, they use public popular datasets to validate the proposed method and evaluate in terms of some metrics such as AUC and HitRatio. They also analyze the proposal in terms of ATE and discover negative correlation between the performance and ATE. The main contributions of this paper are as follows: 1) This is the first work that introduce the idea of causal inference into link prediction task. 2) They make counterfactual links and trained GNN-based methods to learn the causal relationship. 3) The proposed method outperforms the strong baselines.