Fix #10627: post_step clamping process doesn't preserve training labe...#10656
Open
JiwaniZakir wants to merge 2 commits into
Open
Fix #10627: post_step clamping process doesn't preserve training labe...#10656JiwaniZakir wants to merge 2 commits into
JiwaniZakir wants to merge 2 commits into
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10656 +/- ##
==========================================
- Coverage 86.11% 83.94% -2.17%
==========================================
Files 496 510 +14
Lines 33655 36024 +2369
==========================================
+ Hits 28981 30240 +1259
- Misses 4674 5784 +1110 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Closes #10627
The default
post_stepinLabelPropagation.forward(torch_geometric/nn/models/label_prop.py) clamped propagated values to[0, 1]but did not restore labeled node values afterward, causing training labels to be overwritten and collapsing class evidence at high-degree nodes. After theout.clamp_(0., 1.)call, labeled node outputs are now reset to their original one-hot values viaout[mask] = y[mask]whenmask is not None.torch_geometric/nn/models/label_prop.py—LabelPropagation.forward: added two lines after the default clamp to restoreout[mask]fromy[mask]test/nn/models/test_label_prop.py—test_label_prop: added a regression case using a star graph with 6 class-0 and 2 class-1 labeled neighbors aggregating into a single unlabeled hub node, assertingtorch.allclose(out2[mask2], y2_oh[mask2].float())The fix is verified by the new test, which previously failed because the labeled nodes' outputs diverged from their one-hot targets after clamping.
This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.