본문 바로가기
728x90
반응형

분류 전체보기250

[CS224w] Relational GCN (RGCN) Extending GCN to handle heterogeneous grphas 그림과 같이 relation은 하나인 directed graph에 대하여 GCN을 적용해보자. 그렇다면 edge의 방향에 따라 message passing이 이루어지도록 설계하면 될 것이다. 그렇다면 다양한 relation type이 존재한다면 어떻게 message passing을 할 것인가? 어쩔 수 없이 relation 마다 학습하는 weight가 다르게 설계를 한다. (cs224w 강의자료에서는 보기 쉽게 같은 색으로 구분하였다) 즉, 각각의 relation type마다 다른 신경망을 적용하여 convlution을 구현할 수 있다. Introduce a set of neural networks for each relat.. 2023. 8. 9.
[CS224w] Motivation of Heterogeneous Graphs Motivation 지금까지 살펴본 GCN, GraphSAGE, GAT, GIN 모두 노드의 성질(property)이 같은 그래프이다. node feature가 차원이 커도 모든 노드들의 차원이 같기 때문이다. 그러나 실제 그래프 데이터 구조에서 노트 성질, 엣지 성질 등이 다양하기 때문에 앞에서 살펴본 homogeneouse graph로는 충분하지 않다. 노드의 성질이 2개인 경우 예: Paper node, Author node 엣지의 성질이 다양한 경우 예: Cite, Link 하나의 그래프 내에서, 노드와 엣지의 성질이 모두 다양한 경우도 가능하다 2개의 노드와 2개의 엣지가 있다면, 2*2*2=8가지 가능한 relation이 존재한다. 보다시피 relation type은 (node_start, e.. 2023. 8. 8.
[Error] CUDA error: device-side assert triggered 딥러닝을 하다보면 cuda error를 종종 만나게되는데 정말 화가난다 원인 1. Tensor shape 불일치 주로 모델의 출력단계에서 발생. 원인 2. loss function 입출력 불일치 주로 BCELoss의 경우, input의 범위는 [0, 1]이어야 한다. 그렇지 않으면 에러가 발생한다. (solution 2-1) 모델의 출력부분에 시그모이드 등 [0, 1]이 되도록 한다. (solution 2-2) 모델의 출력값에 관계없이 사용할 수 있는 BCELogitsLoss()를 사용한다. 2023. 8. 2.
[CS224w] Label Propagation on Graphs (3) - Correct & Smooth (C&S) Reference Combining Label Propagation and Simple Models Out-performs Graph Neural Networks Introduction Correct & Smooth (C&S)는 node classification method에서 SOTA 이다. 이 글을 포스팅하는 (2023.07.12) ogbn-products의 top-10 중에서 5개는 C&S 방법을 적용하였다. Label Propagation (LP)는 homophily(또는 associativity)를 이용하지만 정작 node feature vector를 이용하지 않는다. 즉 LP는 neighbor averaging이다. Graph Neural Network (GNN)은 feature vector.. 2023. 7. 13.
[CS224w] Label Propagation on Graphs (2) - Label Propagation Label Propagation labeled node는 ground truth label $Y_v^*$로 초기화한다. unlabeled node는 $Y_v = 0.5$로 초기화한다. Update each unlabeled node \[ P^{(t+1)}(Y_v = c) = \cfrac{1}{\sum_{(v, u) \in E} A_{v,u} } \sum_{(v, u) \in E} A_{v, u} P^{(t)}(Y_v = c) \] $A_{v, u}$: edge에 가중치(strength, weight)가 있다면 $A_{v, u}$는 두 노드 $v$와 $u$ 사이의 edge weight를 나타낸다. $P(Y_v = c)$: 노드 $v$가 label이 $c$일 확률 convergence할 때 까지 반복하여 u.. 2023. 7. 13.
[PyG] GIN 예제 코드 Introduction GIN은 graph-level task에 적합한 GNN 모델이다. protein dataset을 이용하여 graph classification을 수행해보자. Setup import gc import os import random import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch_geometric.nn import GCNConv, SAGEConv, GATConv, GINConv, global_add_pool, global_mean_pool from torch_geometric.datasets import TUDataset from torch_geometric.l.. 2023. 7. 12.
728x90
반응형