kg-link-prediction

Trains ComplEx, R-GCN, GraphSAGE, and GAT models for link prediction on NeuroOracle knowledge graphs.

89|5|Updated Mar 25, 2026
One-click install
npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill kg-link-prediction-cuhk-aim-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kg-link-prediction
Source: https://github.com/CUHK-AIM-Group/NeuroDiscovery/tree/main/skills/kg-link-prediction
Command: npx skills add https://github.com/CUHK-AIM-Group/NeuroDiscovery --skill kg-link-prediction-cuhk-aim-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, torch, scikit-learn, and includes scripts (resource) components.

What problem does it solve? It enables training of knowledge-graph embedding and graph neural network models to predict missing relations between entities in a NeuroOracle knowledge graph, producing filtered ranking metrics for hypothesis plausibility scoring. ## Core Features & Use Cases - Multiple Model Architectures: Train ComplEx embeddings or GNN encoders (R-GCN, GraphSAGE, GAT) with relation-aware DistMult decoding through one unified CLI. - Rigorous Evaluation: Computes filtered MRR, Hits@K, AUROC, and AUPRC with train-only message passing and negative sampling checked against all known positives. - Use Case: A researcher loads a NeuroOracle knowledge_graph.json, trains an R-GCN with a confidence threshold of 0.2, and uses the resulting checkpoint and metrics.json to rank candidate cross-domain hypotheses by plausibility. ## Quick Start Train an R-GCN link prediction model on my NeuroOracle knowledge graph JSON with 128-dimensional embeddings and report the filtered MRR and Hits metrics.

Frequently Asked Questions about kg-link-prediction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train a link prediction model on a knowledge graph?

Run the train_reference.py script with your NeuroOracle knowledge_graph.json, selecting a model via --model (complex, rgcn, graphsage, or gat). Set embedding dimension, epochs, and output directory; the script produces a checkpoint.pt and metrics.json.

R-GCN vs GraphSAGE vs GAT for knowledge graph link prediction?

R-GCN uses relation-specific graph convolution, GraphSAGE uses neighborhood aggregation, and GAT uses graph attention; all three pair with relation-aware DistMult decoding. Keep the same split seed when comparing encoders for fair evaluation.

Does this require PyTorch Geometric for GNN training?

No, the implementation uses native PyTorch operations and does not require PyTorch Geometric. You only need numpy, torch, and scikit-learn installed.

How are evaluation metrics computed for link prediction?

GNN models report AUROC, AUPRC, filtered MRR, and filtered Hits metrics. Validation and test edges are excluded from encoder adjacency, and negative samples are checked against all known positive triples.

Can I exclude low-confidence edges from knowledge graph training?

Yes, pass --min-confidence with a threshold value to filter edges below that confidence level from the NeuroOracle graph before training. This helps control noise from weakly supported literature evidence.

When should I retrain the link prediction model?

Retrain whenever the graph snapshot changes materially. Record the graph hash and freeze year when embeddings are used for hindcasting, and verify no post-freeze edge enters training or message passing.