Graph-Relational Domain Adaptation

1 INTRODUCTION . Generalization of machine learning methods hinges on the assumption that training and test data follows the same distribution . Such an assumption no longer holds when one trains a model in some domains ( source domains ) , and tests it in other domains ( target domains ) where data follows different distributions . Domain adaptation ( DA ) aims at improving performance in this setting by aligning data from the source and target domains so that a model trained in source domains can generalize better in target domains ( Ben-David et al. , 2010 ; Ganin et al. , 2016 ; Tzeng et al. , 2017 ; Zhang et al. , 2019 ) . Existing DA methods tend to enforce uniform alignment , i.e. , to treat every domain equally and align them all perfectly . However , in practice the domains are often heterogeneous ; one can expect DA to work well when the source domains are close to the target domains , but not when they are too far from each other ( Zhao et al. , 2019 ; Wang et al. , 2020 ) . Such heterogeneity can often be captured by a graph , where the domains realize the nodes , and the adjacency between two domains can be captured by an edge ( see Fig . 1 ) . For example , to capture the similarity of weather in the US , we can construct a graph where each state is treated as a node and the physical proximity between two states results in an edge . There are also many other scenarios where the relation among domains can be naturally captured by a graph , such as the taxonomies of products in retail or connections among research fields of academic papers . Given a domain graph , we can tailor the adaptation of domains to the graph , rather than dictating the data from all the domains to align perfectly regardless of the graph structure . One naïve DA method for such graph-relational domains is to perform DA for each pair of neighboring domains separately . Unfortunately , due to the strict alignment between each domain pair , this method will still lead to uniform alignment so long as the graph is connected . To generalize DA to the graphrelational domains , we argue that an ideal method should ( 1 ) only enforce uniform alignment when the domain graph is a clique ( i.e. , every two domains are adjacent ) , and ( 2 ) more importantly , relax uniform alignment to adapt more flexibly across domains according to any non-clique domain graph , thereby naturally incorporating information on the domain adjacency . In this paper , we generalize adversarial DA methods and replace the traditional binary ( or multi-class ) discriminator with a novel graph discriminator : instead of distinguishing among different domains , our graph discriminator takes as input the encodings of data to reconstruct the domain graph . We show that our method enjoys the following theoretical guarantees : it recovers classic DA when the the domain graph is a clique , and realizes intuitive alignments for other types of graphs such as chains and stars ( see Fig . 4 ) . We summarize our contributions as follows : • We propose to use a graph to characterize domain relations and develop graph-relational domain adaptation ( GRDA ) as the first general adversarial DA method to adapt across domains living on a graph . • We provide theoretical analysis showing that at equilibrium , our method can retain the capability of uniform alignment when the domain graph is a clique , and achieve non-trivial alignment for other types of graphs . • Empirical results on both synthetic and real-world datasets demonstrate the superiority of our method over the state-of-the-art DA methods . 2 RELATED WORK . Adversarial Domain Adaptation . There have been extensive prior works on domain adaptation ( Pan & Yang , 2009 ; Pan et al. , 2010 ; Long et al. , 2018 ; Saito et al. , 2018 ; Sankaranarayanan et al. , 2018 ; Zhang et al. , 2019 ; Peng et al. , 2019 ; Chen et al. , 2019 ; Dai et al. , 2019 ; Nguyen-Meidine et al. , 2021 ) . Typically they aim to align the distributions of the source and target domains with the hope that the predictor trained on labeled source data can generalize well on target data . Such alignment can be achieved by either directly matching their distributions ’ statistics ( Pan et al. , 2010 ; Tzeng et al. , 2014 ; Sun & Saenko , 2016 ; Peng et al. , 2019 ; Nguyen-Meidine et al. , 2021 ) or training deep learning models with an additional adversarial loss ( Ganin et al. , 2016 ; Zhao et al. , 2017 ; Tzeng et al. , 2017 ; Zhang et al. , 2019 ; Kuroki et al. , 2019 ; Chen et al. , 2019 ; Dai et al. , 2019 ) . The latter , i.e. , adversarial domain adaptation , has received increasing attention and popularity because of its theoretical guarantees ( Goodfellow et al. , 2014 ; Zhao et al. , 2018 ; Zhang et al. , 2019 ; Zhao et al. , 2019 ) , its ability to train end-to-end with neural networks , and consequently its promising empirical performance . These methods typically treat every domain equally and enforce uniform alignment between source-domain data and target-domain data ; this is done by generating domain-invariant encodings , where domain invariance is achieved by training the encoder to fool the discriminator that classifies the domain index . In contrast , we naturally relax such uniform alignment using a graph discriminator to reconstruct a domain graph that describes domain adjacency . Domain Adaptation Related to Graphs . There are also works related to both DA and graphs . Usually they focus on adaptation between two domains where data points themselves are graphs . For example , ( Pilancı & Vural , 2019 ; Pilanci & Vural , 2020 ) use frequency analysis to align the data graphs between the source domain and the target domains , and ( Alam et al. , 2018 ; Ding et al. , 2018 ) perform label propagation on the data graph . In contrast , GRDA considers a setting completely different from the above references . Instead of focusing on adapting between two domains with data points in the form of graphs ( e.g. , each data point itself is a node ) , GRDA adapts across multiple domains ( e.g. , with each state in the US as a domain ) according to a domain graph ( i.e. , each domain is a node ) . Therefore the methods above are not applicable to our setting . Note that ( Mancini et al. , 2019 ) uses metadata-weighted batch normalization to propagate information among domains with similar metadata , but it is not an adversarial domain adaptation method . It is orthogonal to GRDA and can be used as a backbone network to further improve GRDA ’ s performance ( see the Appendix for empirical results ) . It is also worth noting that , in this paper , we assume the domain graph is given . It would be interesting future work to combine GRDA with domain relation inference methods ( e.g. , domain embeddings ( Peng et al. , 2020 ) ) when there is a natural but unobserved graph relation among domains . 3 METHOD . In this section , we will first briefly introduce the problem setting and then elaborate our domain adaptation method . 3.1 PROBLEM SETTING AND NOTATION . We focus on the unsupervised domain adaptation setting with N domains in total . Each domain has a discrete domain index u ∈ U = [ N ] , { 1 , . . . , N } , belonging to either the source domain index set Us or the target domain index set Ut . The relationship between domains is described by a domain graph with the adjacency matrix A = [ Aij ] , where i and j index nodes ( domains ) in the graph . Given labeled data { ( xsl , ysl , usl ) } nl=1 from source domains ( usl ∈ Us ) , unlabeled data { xtl , utl } ml=1 from target domains ( utl ∈ Ut ) , and the domain graph described by A , we want to predict the label { ytl } ml=1 for data from target domains . Note that the domain graph is defined on domains with each domain ( node ) containing multiple data points . 3.2 GRAPH-RELATIONAL DOMAIN ADAPTATION ( GRDA ) . Overview . We use an adversarial learning framework to perform adaptation across graph-relational domains . The adversarial game consists of three players : ( 1 ) an encoder E , which takes as input a datum xl , the associated domain index ul , and the adjacency matrix A to generate an encoding el = E ( xl , ul , A ) , ( 2 ) a predictor F , which makes predictions based on the encoding el , and ( 3 ) a graph discriminator D , which guides the encoding to adapt across graph-relational domains . Specifically , the discriminator D takes in a mini-batch of B encodings el ( l ∈ [ B ] ) , and tries to reconstruct the domain graph A . By letting the encoder E play adversarially against the discriminator D , the graph-relational information of domains will be removed from the encoding el in order to make the discriminator D incapable of reconstructing the graph . Note that the graph discriminator in our adversarial game is different from classic discriminators which classify the domain index , as shown in Fig . 2 . Formally , GRDA performs a minimax optimization with the following loss function : min E , F max D Lf ( E , F ) − λdLd ( D , E ) , ( 1 ) where Lf ( E , F ) is the predictor loss and Ld ( D , E ) is the discriminator loss , and λd is a hyperparameter balancing them two . Below we discussed these two terms in detail . Predictor . In Eqn . 1 , the predictor loss Lf ( E , F ) is defined as Lf ( E , F ) , Es [ hp ( F ( E ( xl , ul , A ) ) , y ) ] , where the expectation Es is taken over the sourcedomain data distribution ps ( x , y , u ) . hp ( · , · ) is a predictor loss function for the task ( e.g. , L2 loss for regression ) . Encoder and Node Embeddings . Given an input tuple ( xl , ul , A ) , the encoder E first computes a graph-informed domain embedding zul based on the domain index ul and the domain graph A . Then we feed zul along with xl into a neural network to obtain the final encoding el . Formally we have el = E ( xl , ul , A ) = f ( xl , zul ) , ( 2 ) where f ( · , · ) is a trainable neural network . In theory , any embeddings for node ( domain ) indices should work equally well so long as they are distinct from one another ( thus forming a bijection to the set of domains [ N ] ) . Here we pre-train the embeddings by a reconstruction loss for simplicity , and our intuition is that good embeddings of nodes should inform us of ( thus reconstruct ) the graph structure . Suppose the nodes indices i and j are sampled independently and identically from the marginal domain index distribution p ( u ) ; the reconstruction loss is written as Lg = Ei , j∼p ( u ) [ −Aij log σ ( z > i zj ) − ( 1−Aij ) log ( 1− σ ( z > i zj ) ) ] , where σ ( x ) = 11+e−x is the sigmoid function . Note that in general we could use any node embedding methods ( Grover & Leskovec , 2016 ; Tang et al. , 2015 ; Kipf & Welling , 2016b ) , but this is not the focus of this paper . For fair comparison , we use exactly the same encoder , i.e. , E ( x , u , A ) , for all the methods in the experiments of Sec . 5 . Graph Discriminator . The discriminator loss Ld ( D , E ) in Eqn . 1 is defined as Ld ( D , E ) , E ( x1 , u1 ) , ( x2 , u2 ) [ h ( x1 , u1 , x2 , u2 ) ] , ( 3 ) h ( x1 , u1 , x2 , u2 ) =−Au1 , u2 log σ ( ẑ > 1 ẑ2 ) − ( 1−Au1 , u2 ) log ( 1− σ ( ẑ > 1 ẑ2 ) , where ẑ1 = D ( E ( x1 , u1 , A ) ) , ẑ2 = D ( E ( x2 , u2 , A ) ) are the discriminator ’ s reconstructions of node embeddings . The expectation E is taken over a pair of i.i.d . samples ( x1 , u1 ) , ( x2 , u2 ) from the joint data distribution p ( x , u ) . The discriminator loss Ld ( D , E ) essentially quantifies how well the reconstructed node embedding ẑ1 , ẑ2 preserve the information of the original connections , or , equivalently , A . We refer readers to the Appendix for detailed model architectures . Due to the adversarial nature of how the discriminator D and the encoder E engage with the loss , the discriminator D would aim to recover the domain graph via the adjacency structure ( A ) , while the encoder E would prevent the discriminator D from doing so . Intuitively , if the discriminator D is powerful enough to uncover any information regarding the domain graph in the encoding el , the optimal encoder E will have to remove all the information regarding graph-relational domains in the encoding el , thus successfully adapting across graph-relational domains . We will formally elaborate the above arguments further in the next section .

Summary: This paper proposes a new model called GRDA to relax the uniform alignment which ignores topological structures among different domains. GRDA uses a domain graph to encode domain adjacency. The authors also generalize the existing adversarial learning framework with a novel graph discriminator using encoding conditioned graph embeddings. Detailed math inductions and proofs are given. Empirical results on both synthetic and real-world datasets demonstrate the superiority of this method.