Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PTGDA: Positive Transfer-aware Graph Domain Adaptation

PTGDA models node-level positive and negative transfer in Graph Domain Adaptation (GDA), selecting source nodes that genuinely benefit target-domain learning while suppressing those that cause negative transfer.


Motivation

Existing GDA methods implicitly assume that all source-domain nodes contribute equally to transfer. In practice, transfer value is heterogeneous at the node level: some source nodes align well with target-domain structure and semantics (positive transfer), while others introduce distribution noise (negative transfer).

PTGDA addresses this by upgrading the transfer value from a static scalar weight to a dynamic, graph-propagated, cross-view-validated node-level score.

Method Focus Contribution
TDSS Target-side structural smoothing Reduces target-domain risk
PTGDA Source-side positive transfer modeling Filters high-value source nodes

The two approaches are naturally complementary and can be combined for further gains.


Core Innovations

  1. Target-Aware Adaptive Valuation (Phase 1)

    • Semantic score: prototype-based confidence matching between source nodes and target class distributions
    • Structural score: topology-feature Mahalanobis alignment measuring structural compatibility
    • Dynamic fusion with class-demand reweighting
  2. Transfer Value Propagation (Phase 2)

    • Spreads node-level transfer values across the source graph via learned propagation
    • Captures neighborhood-level coherence of positive-transfer regions
  3. Cross-View Consistency (Phase 3)

    • Validates transfer value stability across semantic, structural, and prototype views
    • Suppresses noisy or conflicting value estimates

Project Structure

PositiveTransferGDA/
├── configs/
│   ├── default.yaml              # Main configuration
│   ├── sprint.yaml               # Fast experiment config
│   └── ablation/                 # Ablation study configs
│       ├── phase1.yaml
│       ├── phase2.yaml
│       └── phase3.yaml
│
├── src/
│   ├── models/
│   │   ├── encoder.py            # GNN encoder (GCN / A2GNN)
│   │   ├── a2gnn.py              # A2GNN backbone
│   │   ├── layers.py             # Custom graph layers
│   │   └── pt_cross_attn.py      # Positive-transfer cross-attention
│   │
│   ├── valuation/                # Phase 1 – node transfer valuation
│   │   ├── semantic.py           # Prototype-based semantic score
│   │   ├── structural.py         # Topology-feature structural score
│   │   ├── fusion.py             # Score fusion & demand reweighting
│   │   ├── prototype_bank.py     # Dynamic prototype memory bank
│   │   ├── scenario_adaptive.py  # Scenario-adaptive value estimation
│   │   ├── negative_transfer.py  # Negative transfer detection
│   │   ├── target_demand.py      # Target-domain demand modeling
│   │   └── value_aware_bridge.py # Phase 1→2 value bridge
│   │
│   ├── propagation/              # Phase 2 – value propagation
│   │
│   ├── cross_view/               # Phase 3 – cross-view consistency
│   │
│   ├── losses/
│   │   ├── mmd.py                # Weighted MMD loss
│   │   ├── class_mmd.py          # Class-conditional MMD
│   │   ├── contrastive.py        # Contrastive alignment loss
│   │   ├── smoothness.py         # Laplacian smoothness loss
│   │   └── weighted_nsd.py       # Weighted node similarity distillation
│   │
│   └── utils/
│       ├── data.py               # Dataset loading & preprocessing
│       ├── graph.py              # Graph utilities
│       └── metrics.py            # Evaluation metrics
│
├── scripts/
│   ├── train_ptgda.py            # Core PTGDA training (Phase 1)
│   ├── train_ptgda_v4.py         # Latest recommended entry point
│   ├── train_ptgda_full.py       # Full three-phase training
│   ├── train_paper_exact.py      # Reproduces paper results exactly
│   ├── train_tdss.py             # TDSS baseline training
│   ├── train_baseline.py         # Other baseline methods
│   ├── evaluate.py               # Evaluation & metrics
│   ├── diagnose_valuation.py     # Valuation debugging tool
│   ├── run_full_grid.sh          # Full experimental grid
│   ├── run_experiments.sh        # Standard experiment runner
│   └── ...                       # Additional ablation & tuning scripts
│
├── docs/
│   ├── methodology.md
│   └── experiments.md
│
├── requirements.txt
└── README.md

Installation

git clone https://github.com/IamJerryXu/PositiveTransferGDA.git
cd PositiveTransferGDA

pip install torch>=1.12.0 torchvision
pip install torch-geometric torch-scatter torch-sparse
pip install -r requirements.txt

Note: Match torch-scatter and torch-sparse versions to your PyTorch/CUDA installation. See PyG installation guide.


Datasets

Download and place datasets under data/:

Dataset Type Nodes Task
ACMv9 → DBLPv7 Citation ~3K / ~4K Node classification
DBLPv7 → Citationv1 Citation ~4K / ~8K Node classification
Blog Social ~10K Node classification
Airport Transport ~3K Node classification
Twitch (EN, DE) Social ~7K / ~10K Node classification
MAG Academic ~10K Node classification

Quick Start

# Train PTGDA with default config (C → A)
python scripts/train_ptgda.py --config configs/default.yaml

# Latest training entry point (recommended)
python scripts/train_ptgda_v4.py --config configs/default.yaml

# Evaluate a saved checkpoint
python scripts/evaluate.py --checkpoint outputs/best.pt

# Run full experimental grid
bash scripts/run_full_grid.sh

# Reproduce paper-exact results
python scripts/train_paper_exact.py --config configs/default.yaml

Configuration

Key parameters in configs/default.yaml:

model:
  encoder: gcn          # gcn | sage | gat
  hidden_dim: 128
  num_layers: 2

valuation:
  semantic_weight: 0.6  # α – semantic score weight
  structural_weight: 0.4 # β – structural score weight
  update_freq: 50       # re-estimate every N epochs

loss:
  mmd_weight: 7         # λ_mmd
  smoothness_weight: 2e-4

Ablation Study

Three-phase progressive ablation:

Config Phases Enabled Description
ablation/phase1.yaml Phase 1 only Valuation only
ablation/phase2.yaml Phase 1 + 2 + Propagation
ablation/phase3.yaml Full model + Cross-view
python scripts/train_ptgda.py --config configs/ablation/phase1.yaml

References

  • A2GNN: Adversarial Adaptive Graph Neural Networks for GDA
  • TDSS: Target-Domain Structural Smoothing (AAAI 2025)
  • MMD: Maximum Mean Discrepancy for domain alignment

License

This project is licensed under the MIT License.

About

Positive Transfer-aware Graph Domain Adaptation: node-level transfer value modeling with dynamic estimation, graph propagation, and cross-view consistency

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages