GraphCL: 증강을 활용한 그래프 대비 학습 프레임워크
You 등의 “Graph Contrastive Learning with Augmentations”에서 제시한 그래프 대비학습 프레임워크. 이 글은 AI 번역본입니다. 오역이 있을 경우 댓글로 알려주세요.
Created on September 12|Last edited on September 12
Comment
참고: 이 보고서는 그래프 표현 학습 시리즈의 일부입니다. 간략한 개요와 서베이는 다음 글들도 함께 참고하세요.
💡
A Brief Introduction to Graph Contrastive Learning
This article provides an overview of "Deep Graph Contrastive Representation Learning" and introduces a general formulation for Contrastive Representation Learning on Graphs using W&B for interactive visualizations. It includes code samples for you to follow!
GraphCL: Graph Contrastive Learning Framework with Augmentations
Graph Contrastive Learning Framework as outlined in "Graph Contrastive Learning with Augmentations" by You. et al.
Multi-view Graph Representation Learning
Easy to digest breakdown of "Contrastive Multi-View Representation Learning on Graphs" by Kaveh Hassani and Amir Hosein Khasahmadi
Multi-Task Self Supervised Graph Representation Learning
Brief breakdown of Multi-task Self-supervised Graph Neural Network Enable Stronger Task Generalization [ICLR 2023] by Mingxuan Ju, Tong Zhao, Qianlong Wen, Wenhao Yu, Neil Shah, Yanfang Ye and Chuxu Zhang
소개
자기지도 학습은 데이터 자체가 감독 신호를 제공하는 비지도 학습의 한 형태이다. 즉, 클래스 레이블이나 다른 형태의 타깃 정보를 사용하지 않고도 표현을 학습한다. 나중에 파인튜닝을 위한 사전 분포로 활용할 표현을 얻고자 한다면, 데이터의 일부분을 마스킹하고 모델이 누락된 정보를 복원하도록 학습시킬 수 있다.
자기지도 학습의 핵심 축 중 하나는 대비 학습이다. 이는 의미를 보존하는 증강을 통해 원본 데이터를 왜곡하거나 변형하고, 그 변형된 뷰를 모델이 식별하도록 학습하는 방법을 말한다. 대비의 핵심은 모델이 유사한 데이터 포인트의 뷰는 서로 가깝게, 다른 데이터 포인트의 뷰는 멀어지도록 분리하도록 추가로 유도하는 데 있다. 이것이 대비 학습의 요체다. 유사한 클래스의 뷰를 묶도록 모델을 학습시키는 이 단순한 아이디어는 매우 강력한 성과로 이어졌고, SimCLR 같은 뛰어난 기법들을 낳았다.
이 글에서는 논문에서 제시한 Graph Representation Learning용 간단한 대비 학습 프레임워크인 GraphCL을 다룹니다.증강을 활용한 그래프 대조 학습You 등
참고: 그래프 신경망에 대한 기초 지식이 있다고 가정합니다. 간단히 복습이 필요하다면 다음 글을 참고하세요.
💡
목차
방법

그림 1: GraphCL 프레임워크
관련 글에서 소개한 GRACE 프레임워크와 유사하게 그래프 대조 학습 간단 소개, GraphCL 프레임워크는 다른 모달리티에서 탐구된 자기 지도 학습 기법의 모범 사례도 따릅니다. 즉, 공유 인코더와 프로젝션 헤드를 사용합니다. GraphCL과 가장 유사한 프레임워크는 이전에 소개된 SimCLR입니다.
GraphCL 프레임워크는 다음과 같이 요약할 수 있습니다:
- 주어진 그래프 우리는 두 개의 뷰를 생성합니다 증강을 수행함으로써. 저자들은 그래프 도메인에 따라 이러한 증강을 선택적으로 학습합니다.
- 이 두 개의 뷰 그다음 그래프 인코더를 통해 전달합니다 표현으로 이어지며 이러한 그래프 인코더는 어떤 아키텍처든 사용할 수 있습니다.
- 이러한 표현은 그다음 프로젝션 헤드를 통해 전달됩니다 두 개의 뷰를 생성하는 단순한 MLP 네트워크 .
- 그다음 대조 목적함수를 적용합니다 두 개의 뷰 사이에는 정규화된 온도 조정 교차 엔트로피 손실(NT-Xent)을 목적 함수로 사용합니다.
참고: Self-Supervised Learning의 모범 사례에 따라, 명시적으로 네거티브 쌍을 샘플링하지 않습니다. 대신 배치에 있는 다른 그래프의 증강 뷰들이 네거티브 쌍이 됩니다.
💡
이 논문에서 연구한 그래프 증강 기법은 다음의 네 가지입니다:
- 노드 드롭핑: 임의의 그래프에서 , 무작위로 일부 노드와 그에 연결된 엣지를 “드롭”합니다.
- 엣지 교란 이는 그래프의 엣지를 교란하는 것을 포함합니다 엣지를 일정 비율로 무작위로 추가하거나 제거하여 수행합니다.
- 속성 마스킹: 속성 마스킹은 남아 있는 속성, 즉 주변 문맥 정보를 활용해 가려진 노드 속성을 복원하도록 모델을 유도합니다.
- 서브그래프 생성: 이는 무작위 보행을 수행해 원래 그래프에서 서브그래프를 생성하는 것을 포함합니다.
저자들은 데이터 증강의 중요성을 강조하며, 그래프 대조 학습에서 그것이 핵심적이라고 봅니다.
전체 프레임워크는 다음과 같이 일반화할 수 있습니다:
어디에서 는 보통 유사도 함수로 매개변수화된 임의의 학습 가능한 점수 함수입니다 .
코드
class GraphCL(torch.nn.Module):...def train_step(self,augmented_views: List[torch.Tensor],) -> torch.Tensor:"""Perform a single training step.Args:augmented_views (List[torch.Tensor]): Views generated by performing augmentationsReturns:float: Loss."""# Generate Graph Views## Generating representations : intermediate_reps: List[torch.Tensor]intermediate_reps = self.encode(augmented_views)## Generate views : reps: List[torch.Tensor]reps = self.projection_head(intermediate_reps)## Calculate Loss : loss: torch.Tensorloss = self.contrastive_loss(reps)return loss
요약
이 글에서는 “라는 제목의 논문을 간략히 살펴보았습니다.증강을 활용한 그래프 대조 학습유닝 유, 톈롱 천, 융둬 수이, 팅 천, 장양 왕, 양 선이 저술한, 그리고 대조된 (말장난은 의도하지 않았습니다) 이를 앞서 논의한 관련 논문과 비교하여 그래프 대조 학습 간단 소개또한 구현을 개괄적으로 살펴보고, 다음의 강점을 바탕으로 성능 지표를 확인했습니다. Weights & Biases 로깅.
Introduction to Graph Neural Networks
Interested in Graph Neural Networks and want a roadmap on how to get started? In this article, we'll give a brief outline of the field and share blogs and resources!
A Brief Introduction to Graph Contrastive Learning
This article provides an overview of "Deep Graph Contrastive Representation Learning" and introduces a general formulation for Contrastive Representation Learning on Graphs using W&B for interactive visualizations. It includes code samples for you to follow!
An Introduction to GraphSAGE
This article provides an overview of the GraphSAGE neural network architecture, complete with code examples in PyTorch Geometric, and visualizations using W&B.
What are Graph Isomorphism Networks?
This article provides a brief overview of Graph Isomorphism Networks (GIN), complete with code examples in PyTorch Geometric and interactive visualizations using W&B.
Graph Neural Networks (GNNs) with Learnable Structural and Positional Representations
An in-depth breakdown of "Graph Neural Networks with Learnable Structural and Positional Representations" by Vijay Prakash Dwivedi, Anh Tuan Luu, Thomas Laurent, Yoshua Bengio and Xavier Bresson.
Add a comment