論文解讀(SUGRL)《Simple Unsupervised Graph Representation Learning》

發表於2022-03-25

Paper Information

Title:Simple Unsupervised Graph Representation Learning
Authors: Yujie Mo、Liang Peng、Jie Xu, Xiaoshuang Shi、Xiaofeng Zhu
Sources:2022 AAAI
Paper:download
Code:download

Abstract 

  作者提出了一種簡單的無監督圖表示學習方法來進行有效和高效的對比學習。具體而言,通過構造多重損失探索結構資訊與鄰域資訊之間的互補資訊來擴大類間變化,並通過增加一個上限損失來實現正嵌入與錨嵌入之間的有限距離來減小類內變化。因此,無論是擴大類間變化還是減少類內變化,都能使泛化誤差很小,從而得到一個有效的模型。此外,作者的方法消除了以往圖對比學習方法中廣泛使用的資料增強和鑑別器,同時可以輸出低維嵌入,從而得到一個高效的模型。在各種真實資料集上的實驗結果表明,與最先進的方法相比,該方法是有效和高效的。

1 Introduction

  As one of the representative methods of the UGRL,contrastive learning was proposed to maximize Mutual Information (MI) between the input content and its related content.

   The key difference among graph contrastive learning methods is the definitions of the input contents and their related contents.

    • Deep Graph Infomax (DGI) maximizes the MI between the node representations and the summary of the graph.  
    • Graphical Mutual Information (GMI) maximizes the MI between the input graph and the output graph.    
    • GCA (Zhu et al. 2021) maximize the MI between two views for each node through a variety of data augmentations, e.g., attribute masking or edge perturbation.  

  當前對比學習現狀:通常依賴於資料增強來生成輸入內容( input content)及其相關內容(related content),以實現 MI 最大化,從而導致訓練過程的計算成本昂貴。

    

  對比學習常存在的問題:資料增強、高維嵌入表示、對比損失設計,有關方法對比如 Figure 1 所示。

  比如:

    • 資料增強:Grace 和 GCA 通過 remove edges 和 mask node 特性,以生成多個檢視。因此,資料增強(包括資料生成和資料編碼)的計算成本大約需要 20%-40% 的訓練時間。   
    • 高維度嵌入:現有的工作增加了嵌入的維數來提高表示質量,從而增加了訓練時間。原因是這些方法的有效性對維度很敏感。如 DGI 和 GMI 在 512 維空間上達到了它們最好的精度。 
    • 目標函式設計為一個鑑別器:DGI 和 MVGRL 使用一個 discriminator 來測量節點嵌入和圖嵌入的一致性,花費約 10%-30% 的訓練時間。

  基於上述三個問題,本文提出 Simple Unsupervised Graph Representation Learning (SUGRL),框架如 Figure 2 所示:

  

  方法步驟概述:

    • 首先使用一個多層感知器(MLP)在帶語義資訊(semantic information)的輸入上生成 anchor embedding ;  
    • 接著基於 Graph structure 和 Semantic feature 使用 GCN 生成 Positive embedding,此外在 Anchor embedding 上通過 Neighbour sampling 生成另外一種 Positive embedding;
    • 然後在 Anchor embedding 上通過 Row shuffling 生成一種 Negative embedding;
    • 計算損失。

  本文設計了一種新的多重損失,思想是錨點嵌入接近於正嵌入,而遠離負嵌入。【通過減少類內距離,加大類間距離】

  本文貢獻:

    • 首先,為了保證其有效性,我們提出聯合考慮結構資訊和鄰居資訊來探索它們的互補資訊,以擴大類間的變異,並設計一個上界損失來實現較小的類內變異;
    • 其次,為了實現效率,我們在對比學習中去掉了資料增強和鑑別器。這使得我們的方法在大規模資料集上實現可伸縮性;  
    • 最後,對 8 個公共基準資料集進行了綜合的實證研究,驗證了該方法與 11 種比較方法在節點分類方面的有效性和有效性;  

2 Method

  Notations

    • Letting  $\mathcal{G}=(\mathcal{V}, \mathcal{E})$  denote a graph, where  $\mathcal{V}=\left\{v_{1}, v_{2}, \cdots, v_{N}\right\}$  and  $\mathcal{E} \subseteq \mathcal{V} \times \mathcal{V}$  represent the node set and the edge set, respectively. We denote the feature matrix and the adjacency matrix as  $\mathbf{X}=\left\{\mathbf{x}_{i}\right\}_{i=1}^{N}$  and  $\mathbf{A} \in\{0,1\}^{N \times N} $, respectively, where  $\mathbf{x}_{i}$  is the feature of the node  $v_{i}$ , and  $a_{i j}=1$  if  $\left(v_{i}, v_{j}\right) \in \mathcal{E}$  otherwise  $a_{i j}=0$ .
    • In addition, we assume the existence of a set of latent classes  $\mathcal{C}$  over the representation space  $\mathcal{H}$ , since neither the embeddings nor the samples are labeled in unsupervised learning.  

2.1 Anchor and negative embedding generation

  現有的工作大多將 node representation 和 graph summary 作為一個 anchor 。

  比如 

    • DGI and MVGRL treat the graph summary as anchors, which is first convolved by GCN and then summarized by a readout function.  
    • GRACE and GCA regard the node embedding generated in one view as anchors.

  上述產生的問題:大多需要經過 GCN 的傳播,比較耗費時間。

  本文生成 Amchor embedding 的方法是使用 MLP 作用在輸入 $X$ 上,從而生成帶語義資訊的  anchor embedding 。

    $\begin{array}{l}\mathbf{X}^{(l+1)}=\text { Dropout }\left(\sigma\left(\mathbf{X}^{(l)} \mathbf{W}^{(l)}\right)\right) \quad\quad \quad\quad (1)\\ \mathbf{H}=\mathbf{X}^{(l+1)} \mathbf{W}^{(l+1)}\quad\quad\quad \quad\quad\quad\quad\quad\quad\quad\quad(2)\end{array}$

  關於生成 Negative embedding,比較流行的方法如 DGI、GIC、MVGRL 採用的策略是:從原始圖中得到一個被破壞的圖,然後用 GCN 進行處理。本文生成 Negative embedding 的方法是直接通過 row-shuffle 去打亂 Amchor embedding ,從而生成  Negative embedding 。

    $\mathbf{H}^{-}=\operatorname{Shuffle}\left(\left[\mathbf{h}_{1}, \mathbf{h}_{2}, \ldots, \mathbf{h}_{N}\right]\right)\quad\quad\quad(2)$

2.2 Positive embedding generation

  現有的工作通常將結構資訊 [ 資料增強後的檢視為新的圖結構 ] 視為正嵌入(Positive embedding),比如相關的工作有 DGI、MVGRL、GRACE、GCA、GIC 。

  比如:

    • 在 GCA 和 GRACE 中採用隨機圖資料增強;
    • 在 MVGRL 中的圖擴散;

  本文生成了兩種 Positive embedding :

    • structural embeddings  
    • neighbor embeddings  

2.2.1 Structural information

  為了獲取圖的結構資訊,本文采用了廣泛使用的 GCN(以鄰接矩陣 $A$ 和特徵矩陣 $X$ 為輸入) 作為基編碼器:

    $\mathbf{H}^{+^{(l+1)}}=\sigma\left(\widehat{\mathbf{A}} \mathbf{H}^{+^{(l)}} \mathbf{W}^{(l)}\right)\quad\quad\quad\quad(4)$

  其中:

    • $\mathbf{H}^{+(0)}=\mathbf{X}$ 代表輸入特徵;  
    • $\mathbf{H}^{+(l)}$  代表了第 $l^{\text {th }}$ 層的特徵;  
    • $ \widehat{\mathbf{A}}=\hat{\mathbf{D}}^{-1 / 2} \tilde{\mathbf{A}} \hat{\mathbf{D}}^{-1 / 2} \in \mathbb{R}^{N \times N}$ 代表了對稱標準化的鄰接矩陣;  
    • $\hat{\mathbf{D}} \in \mathbb{R}^{N \times N}$ 是度矩陣;  
    • $\tilde{\mathbf{A}}=\mathbf{A}+\mathbf{I}_{N}$ 是帶自環的鄰接矩陣;  

  需要注意的是本文生成 Anchor embedding 的 MLP 是和 這裡的 GCN 共享權重矩陣 $W$ 的。【減少執行時間】

2.2.2 Neighbor information

  為了得到具有鄰居資訊的 Positive embedding,作者首先儲存所有節點的鄰居嵌入索引,然後對其進行抽樣,然後計算樣本的平均值。這樣可以有效地獲取節點的鄰居資訊:

    $\widetilde{\mathbf{h}}_{i}^{+}=\frac{1}{m} \sum\limits _{j=1}^{m}\left\{\mathbf{h}_{j} \mid v_{j} \in \mathcal{N}_{i}\right\}\quad\quad\quad (5)$

  其中

    • $m$ 為取樣鄰居的個數;
    • $\mathcal{N}_{i}$ 表示節點 $v_i$ 的一階鄰居(1-hop)集合;

  總的來說,

    • 結構嵌入(structural embedding)關注的是所有鄰居資訊,因為採用 GCN 獲得結構資訊,而 GCN 資訊傳遞公式簡化為 $AXW$ ;  
    • 鄰居嵌入(neighbor embedding)分別的鄰居的某一部分,通過取樣部分鄰居資訊;  

  因此,他們從不同的角度解釋樣本,從而將它們放在一起考慮,可能獲得它們的互補資訊。

2.3 Multiplet loss

  對比學習目的:Make positive pairs (i.e., anchor and positive embeddings) close while keeping negative pairs (i.e., anchor and negative embeddings) far apart.

  DGI、GMI、MVGRL、GIC 使用雙線性層作為判別器來區分正樣本對和負樣本對,非常耗時間,具體對比可以參考 Figure 6

  本文三目的:

    • 使得 positive pairs 更近,保持 negative pairs 更遠;  
    • 減少泛化誤差,減小泛化誤差對 UGRL 來說也很重要,因為在訓練過程中如果泛化誤差小,可能會提高對比學習的泛化能力  
    • 拉近類內距離,加大類間距離;

  在 SUGRL中,本文以 Triplet loss 損失為基礎,設計一個上限損失來避免使用除鑑別器。拉近類內距離,加大類間距離,具體來說,每個樣本的 Triplet loss 可以表示為:

    $\alpha+d\left(\mathbf{h}, \mathbf{h}^{+}\right)<d\left(\mathbf{h}, \mathbf{h}^{-}\right)\quad\quad\quad(6)$

    • $d(.)$ 是相似度測量方法,如 $\ell_{2}$ -norm distance;
    • $\alpha$ 是非負值,代表著 positive 和 negative embeddings 的 "安全距離" ; 

  補充:triplets loss 知識點

  公式為:

    $L=\max (d(a, p)-d(a, n)+\operatorname{margin}, 0)$

  優化目標:拉近 $a$,$p$ 的距離,拉遠 $a$,$n$ 的距離

    • easy triplets : $L=0$  即 $d(a, p)+ margin <d(a, n)$,這種情況不需要優化,天然 $\mathrm{a}$,$\mathrm{p}$  的距離很近,$  \mathrm{a} $,$\mathrm{n}$  的距離遠;   
    • hard triplets: $d(a, n)<d(a, p) $,即 $a$,$p$ 的距離遠;  
    • semi-hard triplets : $d(a, p)<d(a, n)<d(a, p)+ margin$,即 $\mathrm{a}$,$\mathrm{n}$  的距離靠的很近,但是有一個 $margin$ ;  

  通過對所有負樣本求和,Eq.6  擴充套件為:

    $\mathcal{L}_{\text {triplet }}=\frac{1}{k} \sum_{i=1}^{k}\left\{d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2}-d\left(\mathbf{h}, \mathbf{h}_{i}^{-}\right)^{2}+\alpha\right\}_{+}\quad\quad\quad(7)$

  其中 

    • $\{\cdot\}_{+}=\max \{\cdot, 0\} $  
    • $k$  代表負樣本數  

  為了增加類間差異,作者拉大正負樣本之間的距離,作者在兩種 Positive embedding (考慮 Structural information 和 Neighbor information)上執行以下操作:

    $\mathcal{L}_{S}=\frac{1}{k} \sum_{i=1}^{k}\left\{d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2}-d\left(\mathbf{h}, \mathbf{h}_{i}^{-}\right)^{2}+\alpha\right\}_{+}\quad\quad\quad(8)$

    $\mathcal{L}_{N}=\frac{1}{k} \sum_{j=1}^{k}\left\{d\left(\mathbf{h}, \widetilde{\mathbf{h}}^{+}\right)^{2}-d\left(\mathbf{h}, \mathbf{h}_{j}^{-}\right)^{2}+\alpha\right\}_{+}\quad\quad\quad(9)$

  顯然上式有兩種情況:

    • Case 1:$d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2} \geq d\left(\mathbf{h}, \widetilde{\mathbf{h}}^{+}\right)^{2}$  
    • Case 2:$d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2}<d\left(\mathbf{h}, \widetilde{\mathbf{h}}^{+}\right)^{2}$  

  對於 Case 1:$d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2} \geq d\left(\mathbf{h}, \widetilde{\mathbf{h}}^{+}\right)^{2} $ ,那麼即使 $\text{Eq.9}$ 為 $0$ ,$\text{Eq.8}$ 也不可能小於 $0$ (非負)。此時,我們可以認為 $\mathcal{L}_{S}$ 任然有效,$ \mathcal{L}_{N}$  是無效的。因此,負嵌入可以通過 $Eq.8$ 推離錨點嵌入,這樣類間差異增大。與 Case 1 類似,Case 2 也可以擴大類間差異。

  基於以上分析,Case 1 或 Case 2 都可以增大類間差異。特別是,如果其中一種無效,另一種仍將有效地進一步擴大類間差異。因此,$\text{Eq.8}$ 和 $\text{Eq.9}$ 可以從結構嵌入和鄰域嵌入中獲得互補的資訊,從而能夠擴大類間差異。

  分析 $\text{Eq.7}$:

  $\text{Eq.7}$ 需要保證 $d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2}$ 和 $d\left(\mathbf{h}, \mathbf{h}_{i}^{-}\right)^{2}$ 需要比 $\alpha$ 大,但是它忽略了 Anchor embedding 和 Positive embedding 之間的距離。如果 Anchor embedding 和 Positive embedding 直接的距離特別大,那麼 $\text{Eq.7}$ 任然非負。在這種情況下,類內的變化可能會很大,但這並不有利於泛化誤差的減少。

  為了解決這個問題,作者通過以下目標函式研究了負對和正對的上界(即 $\alpha  + \beta$):

    $\alpha+d\left(\mathbf{h}, \mathbf{h}^{+}\right)<d\left(\mathbf{h}, \mathbf{h}^{-}\right)<d\left(\mathbf{h}, \mathbf{h}^{+}\right)+\alpha+\beta\quad\quad\quad(10)$

  其中:

    • $\beta$  is a non-negative tuning parameter;  

  由式 $\alpha+d\left(\mathbf{h}, \mathbf{h}^{+}\right)<d\left(\mathbf{h}, \mathbf{h}^{-}\right)$ 可知類內差異有限;

  由式 $d\left(\mathbf{h}, \mathbf{h}^{-}\right)<d\left(\mathbf{h}, \mathbf{h}^{+}\right)+\alpha+\beta$ 可知類間差異有限;

  對所有負嵌入的損失加和後,提出的減少類內變化的上界損失定義如下:

    $\mathcal{L}_{U}=-\frac{1}{k} \sum\limits _{i=1}^{k}\left\{d\left(\mathbf{h}, \mathbf{h}^{+}\right)^{2}-d\left(\mathbf{h}, \mathbf{h}_{i}^{-}\right)^{2}+\alpha+\beta\right\}_{-}\quad\quad\quad(11)$

  其中

    • $\{\cdot\}_{-}=\min \{\cdot, 0\} $  

  注意到這裡並沒有考慮 neighbor information ,這是由於

    • 每種資訊都得到了相似的結果;
    • 在實驗中同時使用它們並不能顯著提高模型的效能;  

  最後,將上述損失整合,可以表示為:

    $\mathcal{L}=\omega_{1} \mathcal{L}_{S}+\omega_{2} \mathcal{L}_{N}+\mathcal{L}_{U}\quad\quad\quad(12)$

3 Experiments

3.1 datasets

  在實驗中,作者使用了8個常用的基準資料集,包括3個引文網路資料集(即 Cora, Citeseer 和 Pubmed ), 2個亞馬遜銷售資料集(即照片和計算機),3個大型資料集(即 Ogbn-arxiv、Ogbn-mag 和 Ogbn-products )。

3.2 Baseline

  對比方法包括 1 種傳統演算法(即 DeepWalk ), 2種半監督學習演算法(即 GCN 和 GAT),以及8種非監督學習演算法(即Graph Auto-Encoders (GAE) ,變分圖自動編碼器(VGAE)、DGI 、GRACE 、GMI 、MVGRL 和 GCA 、GIC 。

3.3 Results

  Table 1 和 Table 2 總結了所有方法在 8 個實際圖結構資料集上的分類精度和執行時間。

  

  

  首先,SUGRL在分類精度方面優於所有自監督方法(如DGI、GMI、GRACE、MVGRL、GIC和GCA);例如,作者的方法與最差的方法DGI和最好的比較方法MVGRL相比,平均分別提高了4.0%和1.9%。與學習過程中採用標籤資訊的半監督方法(GCN和GAT)相比,SUGRL也取得了更好的效能。其次,作者的SUGRL的效率是最好的。在8個資料集上,與其他自監督方法相比,SUGRL分別比最慢的比較方法GMI和最快的比較方法GIC平均快了122.4和4.4。

  總之,作者的方法在幾乎所有資料集上,在模型效能和執行時間方面,在節點分類方面都優於其他比較方法。原因可以總結如下。首先,SUGRL綜合考慮結構資訊和鄰域資訊,生成兩種正嵌入及其損失函式,這可以將負嵌入推離錨嵌入更遠(即實現較大的類間變異)。其次,SUGRL採用一個上界來保證正埋點和錨埋點之間的距離是有限的(即實現較小的類內變化)。第三,SUGRL去掉了資料增大和鑑別器的步驟,大大減少了訓練時間。最後,SUGRL可用於輸出低維高質量的嵌入,在保持模型有效性的同時減少訓練時間。

3.4 Ablation study

  UGRL考慮三種資訊,即語義資訊、結構資訊和鄰居資訊,生成兩種具有對應對比損失的正對(LS和LN)。為了驗證框架中各成分的有效性,作者分別研究了結構資訊、鄰居資訊和上界的有效性,以及對比損失中各成分的有效性。
  類內和類間差異之比的有效性。考慮到類內和類間變化的大小不同,將比率歸一化為 $[0,1]$,在圖3的資料集Photo上報告類內與類間變化的比率。首先,與本文方法相比,沒有結構或鄰居資訊的方法通常輸出更大的比率(即更小的類間變異)。二是無上界的方法,與作者的方法相比,還會輸出更大的比率(即更大的類內變數)。這樣就可以驗證結構資訊、鄰居資訊或上界資訊的有效性。

    

4 Conclusion

  在本文中,作者設計了一個簡單的框架,即簡單無監督圖表示學習(SUGRL),以實現有效和高效的對比學習。為了獲得有效性,作者設計了兩個三重組損失函式來探索結構資訊和鄰居資訊之間的互補資訊,以擴大類間的變化,以及一個上限損失來減少類內的變化。為了提高演算法的效率,作者設計了一種去除GCN的生成錨點和負嵌入的方法,並從之前的圖對比學習中去除資料增強和鑑別器。作者對各種真實世界的資料集進行了全面的實驗,實驗結果表明,作者的方法在準確性和可擴充套件性方面都優於目前最先進的方法。

 

 

 


 

論文:

GMI——Graph Representation Learning via Graphical Mutual Information Maximization

DGI——Deep Graph Infomax

GCA——Graph Contrastive Learning with Adaptive Augmentation

MVGRL

CPC——Contrastive Predictive Coding

CMC——Contrastive Multiview Coding

DIM

GRACE

GCA

GIC

 

 

 

 

 

相關文章