How graphdeeplearning/graphtransformer works
Project Type & Purpose
• Type: Research‑oriented full‑stack machine learning/library project
• Purpose: Implement and benchmark the “Graph Transformer” neural network architecture for graph‑structured data tasks (node classification on stochastic block models—SBMs—and graph regression on molecular datasets).
High‑Level Architectural Components
• Configuration Manager
– configs/*.json
– environment_cpu.yml / environment_gpu.yml
– Purpose: drive experiment hyperparameters, dataset choices, model variants, training settings
• Data Layer
– Download scripts (data/script_*.sh)
– Raw datasets (data/SBMs, data/molecules, index files)
– Data loaders & preprocessing (data/data.py, data/SBMs.py, data/molecules.py)
• Model Layer
– Core building blocks (layers/graph_transformer_layer.py, edge & readout layers)
– Network definitions (nets/SBMs_node_classification/…, nets/molecules_graph_regression/…)
– Loader utilities (load_net.py)
• Training & Evaluation
– Training scripts (train/train_SBMs_node_classification.py, train/train_molecules_graph_regression.py)
– Metric computations (train/metrics.py)
– Main entrypoints (main_SBMs_node_classification.py, main_molecules_graph_regression.py)
• Orchestration & Automation
– Batch‐run shell scripts (scripts/SBMs/…, scripts/ZINC/…, scripts/TensorBoard/…)
– Notebooks for statistical result generation (scripts/StatisticalResults/*.ipynb)
• Documentation
– Setup and user guides (docs/01_benchmark_installation.md, 02_download_datasets.md, 03_run_codes.md)
• External Dependencies
– benchmarking‑gnns (external benchmark codebase)
– PyTorch, NumPy, etc. (implicit from environment yml)
Relationships & Data Flows
• Data ingestion: Download scripts → Raw dataset folders → Data loaders → In‑memory graph objects
• Model instantiation: JSON config → instantiate layers & nets → produce PyTorch model
• Training loop: Model + data → train script → metrics, checkpoints → logs (TensorBoard)
• Evaluation: Trained model → test dataset → metrics → statistical results notebook
• Automation: Shell scripts trigger main.py with specific config → batch experiments → output folders
Architectural Patterns & Design Principles
• Modularity: clear separation between data, model, training, configs
• Config‑driven: all hyperparameters and dataset choices are externalized in JSON and YAML
• Reusability: layer definitions are shared across SBMs and molecule tasks
• Experiment reproducibility: environment files + scripts + docs ensure identical runs