pyg_spectral
pyg_spectral
is a PyG-based framework for analyzing, implementing, and benchmarking spectral GNNs with effectiveness and efficiency evaluations.
Why this project?
We list the following highlights of our framework compared to PyG and similar works:
Unified Framework: We offer a plug-and-play collection for spectral models and filters in unified and efficient implementations, rather than a model-specific design. Our rich collection greatly extends the PyG model zoo.
Spectral-oriented Design: We decouple non-spectral designs and feature the pivotal spectral kernel being consistent throughout different settings. Most filters are thus easily adaptable to a wide range of model-level options, including those provided by PyG and PyG-based frameworks.
High scalability: As spectral GNNs are inherently suitable for large-scale learning, our framework is feasible to common scalable learning schemes and acceleration techniques. Several spectral-oriented approximation algorithms are also supported.
Installation
This package can be easily installed by running pip at package root path:
$ pip install -r requirements.txt
$ pip install -e .[benchmark]
The installation script already covers the following core dependencies:
PyTorch Geometric (
>=2.5.3
)TorchMetrics (
>=1.0
): only required forbenchmark/
experiments.Optuna (
>=3.4
): only required for hyperparameter search inbenchmark/
experiments.
For advanced options, please refer to Installation Options.
Reproduce Experiments
Main Experiments
Acquire results on the effectiveness and efficiency of spectral GNNs. Datasets will be automatically downloaded and processed by the code.
Run full-batch models (Table 2, 8, 9):
$ cd benchmark
$ bash scripts/runfb.sh
Run mini-batch models (Table 3, 10, 11):
$ bash scripts/runmb.sh
Additional Experiments
Effect of graph normalization (Figure 3, 9):
$ bash scripts/eval_degree.sh
Figures can be plotted by: benchmark/notebook/fig_degng.ipynb.
Effect of propagation hops (Figure 7, 8):
$ bash scripts/eval_hop.sh
Figures can be plotted by: benchmark/notebook/fig_hop.ipynb.
Frequency response (Table 12):
$ bash scripts/exp_regression.sh