Skip to content

Feat/standard 2 layer gcn#105

Merged
gelluisaac merged 3 commits intoTraqora:mainfrom
soma-enyi:feat/standard-2-layer-gcn
Mar 27, 2026
Merged

Feat/standard 2 layer gcn#105
gelluisaac merged 3 commits intoTraqora:mainfrom
soma-enyi:feat/standard-2-layer-gcn

Conversation

@soma-enyi
Copy link
Copy Markdown
Contributor

Closes #69

feat: Standard 2-layer Graph Convolutional Network using PyG for node classification

Problem

The existing GCN class was a configurable N-layer model that accepted a hidden_dims list. While flexible, it didn't
match the standard 2-layer GCN architecture from Kipf & Welling (2017) — the
canonical baseline for node classification benchmarks. The training script also had no validation loop, making it
impossible to track generalisation during training.

Changes

astroml/models/gcn.py

Replaced the N-layer implementation with a strict 2-layer GCN:

Input → GCNConv(input_dim, hidden_dim) → ReLU → Dropout → GCNConv(hidden_dim, output_dim) → log_softmax

  • Flat, explicit constructor: input_dim, hidden_dim, output_dim, dropout
  • No ambiguity about depth — exactly 2 conv layers as per the paper
  • hidden_dim=16 matches the original Kipf & Welling configuration

astroml/training/train_gcn.py

  • Updated to use the new flat GCN signature
  • Added _accuracy() helper for clean reuse across val and test splits
  • Validation accuracy logged every 20 epochs alongside training loss
  • model.eval() + torch.no_grad() correctly scoped during inference

Before / After

Before:
python
GCN(input_dim=..., hidden_dims=[64], output_dim=..., dropout=0.5)

After:
python
GCN(input_dim=..., hidden_dim=16, output_dim=..., dropout=0.5)

Training output now looks like:
Epoch 20 | Loss: 1.2341 | Val Acc: 0.7100
Epoch 40 | Loss: 0.9823 | Val Acc: 0.7560
...
Test Accuracy: 0.8120

Related

Closes #[69] — Standard 2-layer Graph Convolutional Network using PyG for node classification

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@soma-enyi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@gelluisaac gelluisaac merged commit 0458768 into Traqora:main Mar 27, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ML] Baseline GCN Model Implementation

2 participants