Fix GCN validation and test evaluation - #1442
Open
tandede wants to merge 1 commit into
Open
Conversation
tandede
marked this pull request as ready for review
August 19, 2026 11:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
The training step returned logits produced before
optimizer.updateand while Dropout was active. The validation path reused those stale, stochastic logits for early stopping. The test path computed a freshtest_y_hat, but then accidentally calculated both metrics from the old training-loopy_hatinstead.The new
evaluatehelper temporarily disables training behavior, performs a fresh forward pass with the current parameters, materializes the metrics, and restores the caller's original train/eval state.Validation
python gcn/test.py: 1 test passedpython gcn/main.py --epochs 5 --patience 5 --hidden_dim 8 --nb_layers 1 --dropout 0.5: completed Cora training and final evaluationpre-commit run --files gcn/main.py gcn/test.py: Black and isort passedpython -m compileall -q gcn: passedIn a seeded five-step reproduction, the old pre-update training-mode output reported test loss/accuracy of
1.955827 / 0.199, while a fresh evaluation-mode pass with the final parameters reported1.928995 / 0.236; the maximum logit difference was0.410258.