Repository
KE-HGNN
**KE-HGNN** · Official Implementation · License MIT · Install via pip · Maintenance unknown
- License
- MIT
- nn_method
- Model
- RD_HGNN
- RD-HGNN
- DD_HGNN
- DD-HGNN
Specs
- nn_methodModel
- RD_HGNNRD-HGNN
- DD_HGNNDD-HGNN
README
**The KE-Phase embeds high-order structural knowledge (HOI-Encoder) and task-driven rule knowledge (TDR-Encoder) into vertex features, fused by MDK-Fusion before the HGNN backbone.**
🎯 Overview
Conventional HGNNs rely solely on structure-guided feature smoothing. KE-HGNN instead explicitly extracts and embeds two kinds of knowledge before message passing:
- HOI-Encoder (High-Order Incidence Encoder, Eq. 3) — a permutation-invariant map of the incidence matrix producing structure-related embeddings:
Xs[v] = σ(w · Σe H[v,e] + b). - TDR-Encoder (Task-Driven Rule Encoder, Eq. 4–8) — parses a pre-trained GBDT forest into rule embeddings, with depth-aware weighting
ψp(o) = α / (d(o) + β)(Eq. 6). - MDK-Fusion (Eq. 9) — multi-dimensional knowledge fusion:
Z = Xr ‖ (Xs ⊙ Xr).
Two instantiations:
nn_method |
Model | Definition |
|---|---|---|
RD_HGNN |
RD-HGNN | HGNN(r(X, T), H) — rule knowledge only (Eq. 10) |
DD_HGNN |
DD-HGNN | rule + structure dual knowledge with MDK-Fusion |
📦 Installation
Python 3.11 is recommended. All datasets are downloaded automatically by the
DHG library on first use.
pip install -r requirements.txt
For GPU support, install a CUDA build of PyTorch first, e.g.:
pip install torch --index-url https://download.pytorch.org/whl/cu121
🚀 Quick Start
# single run (default: Cora, RD-HGNN)
python train.py
# paper setting: 5 seeds, mean ± std
python run_multi_seed.py
# switch to DD-HGNN
python run_multi_seed.py model.nn_method=DD_HGNN
All hyperparameters live in configs/trans_config.yaml and can be overridden
from the command line via hydra.
📊 Results
Transductive vertex classification (accuracy %, 5 seeds, Table V in the paper):
| Dataset | MLP | GCN | GBDT | HGNN | RD-HGNN | DD-HGNN |
|---|---|---|---|---|---|---|
| Cora | 69.04 ± 2.04 | 83.63 ± 1.12 | 74.30 ± 1.67 | 81.81 ± 2.51 | 88.64 ± 1.34 | 87.22 ± 1.30 |
| CA-Cora | 68.32 ± 2.90 | 75.23 ± 2.05 | 71.54 ± 2.08 | 75.67 ± 2.38 | 79.36 ± 2.60 | 79.75 ± 2.10 |
| CC-Cora | 68.55 ± 3.30 | 73.21 ± 1.22 | 71.69 ± 2.12 | 73.41 ± 2.16 | 74.30 ± 4.09 | 76.06 ± 3.48 |
| DBLP-Conf | 79.24 ± 0.47 | 90.57 ± 0.81 | 79.77 ± 1.62 | 93.79 ± 0.40 | 94.68 ± 0.22 | 94.84 ± 0.50 |
Reproduce
bash reproduce/run_core_datasets.sh # all four datasets × {RD-HGNN, DD-HGNN}
or individually (hyperparameters from Table IV of the paper):
# Cora (graph)
python run_multi_seed.py data.name=cora model.n_est=60 model.max_depth=4 model.alpha=10 model.beta=6 model.xgb_lr=0.6 model.nn_method=RD_HGNN
# CA-Cora (coauthorship hypergraph)
python run_multi_seed.py data.name=coauthorship_cora model.n_est=40 model.max_depth=5 model.alpha=7 model.beta=8 model.xgb_lr=0.4 model.nn_method=RD_HGNN
# CC-Cora (cocitation hypergraph)
python run_multi_seed.py data.name=cocitation_cora model.n_est=140 model.max_depth=3 model.alpha=9 model.beta=8 model.xgb_lr=0.4 model.nn_method=RD_HGNN
# DBLP-Conf (hypergraph)
python run_multi_seed.py data.name=dblp4k-conf model.n_est=100 model.max_depth=3 model.alpha=9 model.beta=10 model.xgb_lr=0.4 model.nn_method=RD_HGNN
The transductive split is 60% train / 25% val / 15% test (stratified), matching
Table II of the paper; graph datasets use their original edges directly as
size-2 hyperedges (cf. Table I).
<details>
<summary><b>Available datasets</b> (via DHG)</summary>
Graphs: cora, pubmed, citeseer.
Hypergraphs: coauthorship_cora, coauthorship_dblp, cocitation_cora,
cocitation_pubmed, cocitation_citeseer, dblp4k-paper, dblp4k-term,
dblp4k-conf, imdb4k, news20, recipe-100k, recipe-200k.
</details>
🗂 Project Structure
├── configs/trans_config.yaml # hydra config (per-dataset hyperparameters in comments)
├── ke_hgnn/
│ ├── model.py # KE_HGNN estimator + NeuralNet (RD_HGNN / DD_HGNN backbones)
│ ├── tdr_encoder.py # TDR-Encoder
│ └── utils.py # data loading, splits, hypergraph helpers, multi-seed metric
├── train.py # single-seed entry
├── run_multi_seed.py # 5-seed mean ± std entry
└── reproduce/run_core_datasets.sh
📝 Citation
@article{feng2026kehgnn,
title = {Knowledge-Embedded Hypergraph Neural Networks},
author = {Feng, Yifan and Zhang, Yifan and Du, Shaoyi and Ying, Shihui and Wu, Zongze and Gao, Yue},
journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
volume = {48},
number = {7},
pages = {8613--8625},
month = jul,
year = {2026},
doi = {10.1109/TPAMI.2026.3674800}
}
📄 License
This project is released under the MIT License.