-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add Attract-Repel link prediction model #10105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Attract-Repel link prediction model #10105
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
puririshi98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM just get CI green (the precommit needs fix from you, the other one isnt related to you so hopefully it just goes away when you fix the precommit one)
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Thank you, Rishi It passed the precommit now! looking forward to seeing this in the repo 😄 . so excited for this! |
|
need fix for https://github.com/pyg-team/pytorch_geometric/actions/runs/14187814330/job/39794651601?pr=10105: |
…/tommyly201/pytorch_geometric into feature/attract-repel-embeddings
for more information, see https://pre-commit.ci
…/tommyly201/pytorch_geometric into feature/attract-repel-embeddings
for more information, see https://pre-commit.ci
puririshi98
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the CI failure remaining does not seem related, hopefully gets fixed soon
|
@tommyly201 just keep updating the branch as updates come to master and it should merge itself once its green, then ill merge the example PR |
…/tommyly201/pytorch_geometric into feature/attract-repel-embeddings
…/tommyly201/pytorch_geometric into feature/attract-repel-embeddings
Invalid email address
# Attract-Repel Link Prediction Example This PR adds an example implementation showcasing the attract-repel embeddings (from PR #10105) on link prediction tasks. The example demonstrates how attract-repel embeddings can significantly improve performance on citation networks. ## Overview The example: - Compares traditional vs attract-repel embeddings on link prediction - Works with standard Planetoid datasets (Cora, CiteSeer, PubMed) - Shows performance improvements across different networks - Calculates and reports the R-fraction for analysis ## Results | Dataset | Method | Test AUC | |---------|--------|----------| | Cora | Traditional | 0.6624 | | Cora | Attract-Repel | 0.8945 | | PubMed | Traditional | 0.8977 | | PubMed | Attract-Repel | 0.9607 | | CitiSeer | Traditional | 0.8067 | | CitiSeer | Attract-Repel | 0.8206 | The attract-repel approach shows consistent improvements across datasets: - **Cora**: +0.2321 AUC (R-fraction: 0.4075) - **PubMed**: +0.0630 AUC (R-fraction: 0.5062) - **CitiSeer**: +0.0139 AUC (R-fraction: 0.4869) The varying R-fractions indicate that the model adapts to different graph structures, with PubMed using more of the repel component than Cora. ## Usage Traditional approach: python examples/ar_link_pred.py --dataset Cora Attract-Repel approach python examples/ar_link_pred.py --dataset Cora --use_ar This example complements the attract-repel embeddings implementation in PR #10105. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rishi Puri <[email protected]> Co-authored-by: Rishi Puri <[email protected]>
# Add Attract-Repel Embeddings for Link Prediction This PR adds an implementation of Attract-Repel embeddings from the paper "Pseudo-Euclidean Attract-Repel Embeddings for Undirected Graphs" by Peysakhovich et al. ## Overview Attract-Repel embeddings address a fundamental limitation in traditional graph embeddings: their inability to effectively represent non-transitive relationships. The method splits node representations into two components: - Attract component: nodes with similar attract vectors are likely to connect - Repel component: nodes with similar repel vectors are unlikely to connect Link prediction scores are calculated as: attract_dot_product - repel_dot_product ## Implementation - Added `ARLinkPredictor` class that implements the core functionality - Added thorough tests to validate the implementation - The implementation is minimal and focused on the core concept ## Benefits - Improves link prediction performance on graphs with non-transitive relationships - Requires minimal architectural changes to existing models - Provides useful information about graph structure through R-fraction analysis - Example PR [pyg-team#10107 ](pyg-team#10107) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rishi Puri <[email protected]> Co-authored-by: Rishi Puri <[email protected]>
# Attract-Repel Link Prediction Example This PR adds an example implementation showcasing the attract-repel embeddings (from PR pyg-team#10105) on link prediction tasks. The example demonstrates how attract-repel embeddings can significantly improve performance on citation networks. ## Overview The example: - Compares traditional vs attract-repel embeddings on link prediction - Works with standard Planetoid datasets (Cora, CiteSeer, PubMed) - Shows performance improvements across different networks - Calculates and reports the R-fraction for analysis ## Results | Dataset | Method | Test AUC | |---------|--------|----------| | Cora | Traditional | 0.6624 | | Cora | Attract-Repel | 0.8945 | | PubMed | Traditional | 0.8977 | | PubMed | Attract-Repel | 0.9607 | | CitiSeer | Traditional | 0.8067 | | CitiSeer | Attract-Repel | 0.8206 | The attract-repel approach shows consistent improvements across datasets: - **Cora**: +0.2321 AUC (R-fraction: 0.4075) - **PubMed**: +0.0630 AUC (R-fraction: 0.5062) - **CitiSeer**: +0.0139 AUC (R-fraction: 0.4869) The varying R-fractions indicate that the model adapts to different graph structures, with PubMed using more of the repel component than Cora. ## Usage Traditional approach: python examples/ar_link_pred.py --dataset Cora Attract-Repel approach python examples/ar_link_pred.py --dataset Cora --use_ar This example complements the attract-repel embeddings implementation in PR pyg-team#10105. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Rishi Puri <[email protected]> Co-authored-by: Rishi Puri <[email protected]>
Add Attract-Repel Embeddings for Link Prediction
This PR adds an implementation of Attract-Repel embeddings from the paper "Pseudo-Euclidean Attract-Repel Embeddings for Undirected Graphs" by Peysakhovich et al.
Overview
Attract-Repel embeddings address a fundamental limitation in traditional graph embeddings: their inability to effectively represent non-transitive relationships. The method splits node representations into two components:
Link prediction scores are calculated as: attract_dot_product - repel_dot_product
Implementation
ARLinkPredictorclass that implements the core functionalityBenefits