Skip to main content

A Python library for Graph Domain Adaptation

Project description

PyGDA is a Python library for Graph Domain Adaptation built upon PyTorch and PyG to easily train graph domain adaptation models in a sklearn style. PyGDA includes 15+ graph domain adaptation models. See examples with PyGDA below!

Graph Domain Adaptation Using PyGDA with 5 Lines of Code

from pygda.models import A2GNN

# choose a graph domain adaptation model
model = A2GNN(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, device=args.device)

# train the model
model.fit(source_data, target_data)

# evaluate the performance
logits, labels = model.predict(target_data)

PyGDA is featured for:

  • Consistent APIs and comprehensive documentation.
  • Cover 15+ graph domain adaptation models.
  • Scalable architecture that efficiently handles large graph datasets through mini-batching and sampling techniques.
  • Seamlessly integrated data processing with PyG, ensuring full compatibility with PyG data structures.

Installation

Note: PyGDA depends on PyTorch, PyG, and PyTorch Sparse. PyGDA does not automatically install these libraries for you. Please use the provided links above to install them separately in order to run PyGDA successfully.

  • torch>=1.13.1
  • torch_geometric>=2.4.0
  • torch_sparse>=0.6.15

Installation for local development:

git clone https://github.com/pygda-team/pygda
cd pygda

Required Dependencies:

  • python
  • scipy
  • sklearn
  • numpy
  • cvxpy

Quick Start

Step 1: Load Data

from pygda.datasets import CitationDataset

source_dataset = CitationDataset(path, args.source)
target_dataset = CitationDataset(path, args.target)

Step 2: Build Model

from pygda.models import A2GNN

model = A2GNN(in_dim=num_features, hid_dim=args.nhid, num_classes=num_classes, device=args.device)

Step 3: Fit Model

model.fit(source_data, target_data)

Step 4: Evaluation

from pygda.metrics import eval_micro_f1, eval_macro_f1

logits, labels = model.predict(target_data)
preds = logits.argmax(dim=1)
mi_f1 = eval_micro_f1(labels, preds)
ma_f1 = eval_macro_f1(labels, preds)

Create your own GDA model

In addition to the easy application of existing GDA models, PyGDA makes it simple to implement custom models.

  • the customed model should inherit BaseGDA class.
  • implement your fit(), forward_model(), and predict() functions.

Reference

ID Paper Method Venue
1 DANE: Domain Adaptive Network Embedding DANE IJCAI 2019
2 Adversarial Deep Network Embedding for Cross-network Node Classification ACDNE AAAI 2020
3 Unsupervised Domain Adaptive Graph Convolutional Networks UDAGCN WWW 2020
4 Adversarial Separation Network for Cross-Network Node Classification ASN CIKM 2021
5 Graph Transfer Learning via Adversarial Domain Adaptation with Graph Convolution AdaGCN TKDE 2022
6 Non-IID Transfer Learning on Graphs GRADE AAAI 2023
7 Graph Domain Adaptation via Theory-Grounded Spectral Regularization SpecReg ICLR 2023
8 Structural Re-weighting Improves Graph Domain Adaptation StruRW ICML 2023
9 Improving Graph Domain Adaptation with Network Hierarchy JHGDA CIKM 2023
10 Bridged-GNN: Knowledge Bridge Learning for Effective Knowledge Transfer KBL CIKM 2023
11 Domain-adaptive Message Passing Graph Neural Network DMGNN NN 2023
12 Correntropy-Induced Wasserstein GCN: Learning Graph Embedding via Domain Adaptation CWGCN TIP 2023
13 SA-GDA: Spectral Augmentation for Graph Domain Adaptation SAGDA MM 2023
14 Graph Domain Adaptation: A Generative View DGDA TKDD 2024
15 Rethinking Propagation for Unsupervised Graph Domain Adaptation A2GNN AAAI 2024
16 Pairwise Alignment Improves Graph Domain Adaptation PairAlign ICML 2024

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygda-0.0.1.tar.gz (64.1 kB view details)

Uploaded Source

Built Distribution

pygda-0.0.1-py2.py3-none-any.whl (110.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pygda-0.0.1.tar.gz.

File metadata

  • Download URL: pygda-0.0.1.tar.gz
  • Upload date:
  • Size: 64.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.13

File hashes

Hashes for pygda-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4c186f94b04c6b4c50d74ef80ca065f6b0c49a81b332d8f3ce4f8ec45b85ccfd
MD5 a485cf4f9eb49f269d96b29ef93f71db
BLAKE2b-256 4fdc190d1a622da9be114f31e383ba9de5e1a5f56cb429b3d1da308d7b50bbd7

See more details on using hashes here.

File details

Details for the file pygda-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: pygda-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 110.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.13

File hashes

Hashes for pygda-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6b49e988762a284476ca2890ed531cb746a2d87e0a2c4ec6a713c2402103565d
MD5 049a1f6a1d66db70245bd62e54636e73
BLAKE2b-256 56b9527af2c6c0eda342938cc0d82e3a66d152f60ae1331e537909b40272e142

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page