Skip to content

yin-gz/Nary-Inductive-SubGraph

Repository files navigation

Inductive Link Prediction on N-ary Relational Facts via Semantic Hypergraph Reasoning

The official codes for paper "Inductive Link Prediction on N-ary Relational Facts via Semantic Hypergraph Reasoning" [KDD'25, V.1].

☺️Welcome to the blogs for this paper:

English Version

Chinese Version

Overview of the proposed NS-HART

...

Based on the assumption that extended neighboring subgraphs of the source entities (i.e. known entities in the incomplete fact being predicted) contain inference clues for inductive link prediction, we aim to develop an effective solution tailored for n-ary relational KGs via subgraph reasoning.

First, we samle K-hop neighborhoods from the source entities. Then, we introduce n-ary subgraph aggregating networks to learn from the sampled subgraph, deriving node and hyperedge embeddings enriched with neighborhood contexts. Finally, link prediction is achieved by calculating scores between the updated embeddings of the source hyperedge and the potential candidate entities. Please refer to the paper for details.

Installing Dependencies

Preparation

  • Make directories: ./checkpoints
  • Configure wandb in run.py, set wandb.login(key="") to your wandb key. ( This step is optional, you can also set use_wandb == False)
  • Download datasets from , put them in ../data/nary directory.

Training and Evaluating

  • Parameters for reproducing the reported results of HART are saved in ./config.
  • You can find the official reproduce reports using wandb here.

Training and Evaluating

Task: TR-EF

# WD20K (100) V1
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -task "TR-EF"
  
# WD20K (66) V1
python run.py -config_file True -dataset "FI_WD20K66" -version "v1" -task "TR-EF"
  
# WD20K (100) V2
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -task "TR-EF"

# WD20K (66) V2
python run.py -config_file True -dataset "FI_WD20K66" -version "v2" -task "TR-EF"

Task: TR-NEF

# WD20K (100) V1
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -task "TR-NEF"
  
# WD20K (66) V1
python run.py -config_file True -dataset "FI_WD20K66" -version "v1" -task "TR-NEF"
  
# FI-MFB (100)
python run.py -config_file True -dataset "FI_MFB15K100" -task "TR-NEF"

# FI-MFB (33)
python run.py -config_file True -dataset "FI_MFB15K33" -task "TR-NEF"

Task: PSR

# WD20K (100) V1
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -task "PSR"
  
# WD20K (66) V1
python run.py -config_file True -dataset "FI_WD20K66" -version "v1" -task "PSR"
  
# FI-MFB (100)
python run.py -config_file True -dataset "FI_MFB15K100" -task "PSR"

# FI-MFB (33)
python run.py -config_file True -dataset "FI_MFB15K33" -task "PSR"

Ablation Study (TR-EF as an example)

# w/o message passing
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -model_name "SubgTrans" -task "TR-EF"

# w/o high-order relations
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -model_name "HART" -binary True -task "TR-EF"

# HART (intra-edge)
python run.py -config_file True -dataset "FI_WD20K100" -version "v1" -model_name "HART-Intra"  -task "TR-EF"

Reproduce Other Baselines

# eg.QBLP
python run.py -dataset "FI_WD20K100" -version "v1" -model_name "QBLP"  -task "TR-EF"
# eg.UniSAGE
python run.py -dataset "FI_WD20K100" -version "v1" -model_name "HyperAggModel" -hagg_method "sage" -task "TR-EF"

If you find this work helpful, please kindly cite:

@inproceedings{10.1145/3690624.3709195,
author = {Yin, Gongzhu and Zhang, Hongli and Yang, Yuchen and Luo, Yi},
title = {Inductive Link Prediction on N-ary Relational Facts via Semantic Hypergraph Reasoning},
year = {2025},
isbn = {9798400712456},
url = {https://doi.org/10.1145/3690624.3709195},
doi = {10.1145/3690624.3709195},
booktitle = {Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V.1},
pages = {1821–1832},
numpages = {12},
series = {KDD '25}
}

For any further questions, feel free to contact: yingz@hit.edu.cn

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages