Skip to content

The official source code of the paper "Unsupervised Episode Generation for Graph Meta-learning" (to be presented in ICML 2024)

Notifications You must be signed in to change notification settings

JhngJng/NaQ-PyTorch

Repository files navigation

Unsupervised Episode Generation for Graph Meta-learning

The source code of the unsupervised episode generation method called Neighbors as Queries (NaQ) from the paper "Unsupervised Episode Generation for Graph Meta-learning"
(This paper will be presented in ICML 2024.)

Overview

By generating training episodes in an unsupervised manner, our NaQ enables unsupervised Graoh Meta-learning via unsupervised training of existing graph meta-learning methods.
To check further details, please refer to the slide or provided arXiv link.

1. NaQ-Feat

NaQ-Feat generates query set by sampling raw-feature level similar nodes for each randomly sampled support set nodes in the entire graph.

2. NaQ-Diff

NaQ-Diff generates query set by sampling structurally similar nodes found via graph Diffusion for each randomly sampled support set nodes in the entire graph.

Abstract

We propose Unsupervised Episode Generation method called Neighbors as Queries (NaQ) to solve the Few-Shot Node-Classification (FSNC) task by unsupervised Graph Meta-learning. Doing so enables full utilization of the information of all nodes in a graph, which is not possible in current supervised meta-learning methods for FSNC due to the label-scarcity problem. In addition, unlike unsupervised Graph Contrastive Learning (GCL) methods that overlook the downstream task to be solved at the training phase resulting in vulnerability to class imbalance of a graph, we adopt the episodic learning framework that allows the model to be aware of the downstream task format, i.e., FSNC. The proposed NaQ is a simple but effective unsupervised episode generation method that randomly samples nodes from a graph to make a support set, followed by similarity-based sampling of nodes to make the corresponding query set. Since NaQ is model-agnostic, any existing supervised graph meta-learning methods can be trained in an unsupervised manner, while not sacrificing much of their performance or sometimes even improving them. Extensive experimental results demonstrate the effectiveness of our proposed unsupervised episode generation method for graph meta-learning towards the FSNC task.

How to check implementations?

To check implementations of NaQ, please see task_generator.py method .query_generation_NaQ().

How to Run?

To run our methods with ProtoNet (e.g. in Amazon-Clothing, 5-way 1-shot)

# NaQ-Feat
python unsup_protonet.py --dataset Amazon_clothing --n_way 5 --k_shot_test 1 --query_generation NaQ --type feature --lr 1e-4
# NaQ-Diff
python unsup_protonet.py --dataset Amazon_clothing --n_way 5 --k_shot_test 1 --query_generation NaQ --type diffusion --lr 1e-4

Requirements

python=3.8.13
pytorch=1.11.0
scikit-learn=1.1.1
numpy=1.21.5
scipy=1.5.3
pyg=2.0.4 (torch-geometric)

About

The official source code of the paper "Unsupervised Episode Generation for Graph Meta-learning" (to be presented in ICML 2024)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages