Awesome
<div align="center"> <img src="https://github.com/lyyf2002/ASGEA/blob/master/IMG/logo.png" alt="Logo" width="400"> </div>ποΈ ASGEA: Exploiting Logic Rules from Align-Subgraphs for Entity Alignment
<div align="center"> <img src="https://github.com/lyyf2002/ASGEA/blob/master/IMG/model.jpg" width="95%" height="auto" /> </div>This paper proposes the Align-Subgraph Entity Alignment (ASGEA) framework to exploit logic rules from Align-Subgraphs. ASGEA uses anchor links as bridges to construct Align-Subgraphs and spreads along the paths across KGs, which distinguishes it from the embedding-based methods.
π¬ Dependencies
pytorch 1.12.0
torch_geometric 2.2.0
torch_scatter 2.0.9
transformers 4.26.1
π Train
- Quick start: Using script file for ASGEA-MM.
# FBDB15K & FBYG15K
>> bash run.sh FB
# DBP15K
>> bash run_dbp.sh DBP
# Multi OpenEA
>> bash run_oea.sh OEA
-
βtips: If you are using slurm, you can change the
.sh
file fromdatas="FBDB15K FBYG15K" rates="0.2 0.5 0.8" expn=$1 if [ ! -d "results/${expn}" ]; then mkdir results/${expn} fi if [ ! -d "results/${expn}/backup" ]; then mkdir results/${expn}/backup fi cp *.py results/${expn}/backup/ for data in $datas ; do for rate in $rates ; do python train.py --data_split norm --n_batch 4 --n_layer 5 --lr 0.001 --data_choice ${data} --data_rate ${rate} --exp_name ${expn} --mm 1 --img_dim 4096 # echo "sbatch -o ${data}_${rate}.log run.slurm 4 5 0.001 ${data} ${rate}" # sbatch -o ${expn}_${data}_${rate}.log run.slurm 4 5 0.001 ${data} ${rate} ${expn} done done
to
datas="FBDB15K FBYG15K" rates="0.2 0.5 0.8" expn=$1 if [ ! -d "results/${expn}" ]; then mkdir results/${expn} fi if [ ! -d "results/${expn}/backup" ]; then mkdir results/${expn}/backup fi cp *.py results/${expn}/backup/ for data in $datas ; do for rate in $rates ; do echo "sbatch -o ${data}_${rate}.log run.slurm 4 5 0.001 ${data} ${rate}" sbatch -o ${expn}_${data}_${rate}.log run.slurm 4 5 0.001 ${data} ${rate} ${expn} done done
-
for ASGEA-Stru: Just set
mm=0
.
π Dataset
βNOTE: Download from ufile (1.69G) and unzip it to make those files satisfy the following file hierarchy:
ROOT
βββ data
β βββ mmkg
βββ ASGEA
Code Path
<details> <summary>π π Click</summary>ASGEA
βββ base_model.py
βββ data.py
βββ load_data.py
βββ models.py
βββ opt.py
βββ README.md
βββ run.sh
βββ run.slurm
βββ run_dbp.sh
βββ run_dbp.slurm
βββ run_oea.sh
βββ run_oea.slurm
βββ train.py
βββ utils.py
βββ vis.py
</details>
Data Path
<details> <summary>π π Click</summary>mmkg
ββ DBP15K
β ββ fr_en
β β ββ att_features100.npy
β β ββ att_features500.npy
β β ββ att_rel_features100.npy
β β ββ att_rel_features500.npy
β β ββ att_val_features100.npy
β β ββ att_val_features500.npy
β β ββ en_att_triples
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ fr_att_triples
β β ββ ill_ent_ids
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ ja_en
β β ββ att_features100.npy
β β ββ att_features500.npy
β β ββ att_rel_features100.npy
β β ββ att_rel_features500.npy
β β ββ att_val_features100.npy
β β ββ att_val_features500.npy
β β ββ en_att_triples
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ill_ent_ids
β β ββ ja_att_triples
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ translated_ent_name
β β ββ dbp_fr_en.json
β β ββ dbp_ja_en.json
β β ββ dbp_zh_en.json
β ββ zh_en
β ββ att_features100.npy
β ββ att_features500.npy
β ββ att_rel_features100.npy
β ββ att_rel_features500.npy
β ββ att_val_features100.npy
β ββ att_val_features500.npy
β ββ en_att_triples
β ββ ent_ids_1
β ββ ent_ids_2
β ββ ill_ent_ids
β ββ rule_test.txt
β ββ rule_train.txt
β ββ training_attrs_1
β ββ training_attrs_2
β ββ triples_1
β ββ triples_2
β ββ zh_att_triples
ββ FBDB15K
β ββ norm
β ββ DB15K_NumericalTriples.txt
β ββ FB15K_NumericalTriples.txt
β ββ att_features.npy
β ββ att_rel_features.npy
β ββ att_val_features.npy
β ββ ent_ids_1
β ββ ent_ids_2
β ββ fbid2name.txt
β ββ id2relation.txt
β ββ ill_ent_ids
β ββ training_attrs_1
β ββ training_attrs_2
β ββ triples_1
β ββ triples_2
ββ FBYG15K
β ββ norm
β ββ FB15K_NumericalTriples.txt
β ββ YAGO15K_NumericalTriples.txt
β ββ att_features.npy
β ββ att_rel_features.npy
β ββ att_val_features.npy
β ββ ent_ids_1
β ββ ent_ids_2
β ββ fbid2name.txt
β ββ id2relation.txt
β ββ ill_ent_ids
β ββ training_attrs_1
β ββ training_attrs_2
β ββ triples_1
β ββ triples_2
ββ MEAformer
ββ OpenEA
β ββ OEA_D_W_15K_V1
β β ββ att_features.npy
β β ββ att_features500.npy
β β ββ att_rel_features.npy
β β ββ att_rel_features500.npy
β β ββ att_val_features.npy
β β ββ att_val_features500.npy
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_D_W_15K_V2
β β ββ att_features.npy
β β ββ att_features500.npy
β β ββ att_rel_features.npy
β β ββ att_rel_features500.npy
β β ββ att_val_features.npy
β β ββ att_val_features500.npy
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_D_Y_15K_V1
β β ββ 721_5fold
β β β ββ 1
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 2
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 3
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 4
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 5
β β β ββ test_links
β β β ββ train_links
β β β ββ valid_links
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ent_links
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ rel_triples_1
β β ββ rel_triples_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_D_Y_15K_V2
β β ββ 721_5fold
β β β ββ 1
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 2
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 3
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 4
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 5
β β β ββ test_links
β β β ββ train_links
β β β ββ valid_links
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ent_links
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ rel_triples_1
β β ββ rel_triples_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_EN_DE_15K_V1
β β ββ att_features.npy
β β ββ att_features500.npy
β β ββ att_rel_features.npy
β β ββ att_rel_features500.npy
β β ββ att_val_features.npy
β β ββ att_val_features500.npy
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_EN_DE_15K_V2
β β ββ 721_5fold
β β β ββ 1
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 2
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 3
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 4
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 5
β β β ββ test_links
β β β ββ train_links
β β β ββ valid_links
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ent_links
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ rel_triples_1
β β ββ rel_triples_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_EN_FR_15K_V1
β β ββ att_features.npy
β β ββ att_rel_features.npy
β β ββ att_val_features.npy
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ training_attrs_1
β β ββ training_attrs_2
β β ββ triples_1
β β ββ triples_2
β ββ OEA_EN_FR_15K_V2
β β ββ 721_5fold
β β β ββ 1
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 2
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 3
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 4
β β β β ββ test_links
β β β β ββ train_links
β β β β ββ valid_links
β β β ββ 5
β β β ββ test_links
β β β ββ train_links
β β β ββ valid_links
β β ββ attr_triples_1
β β ββ attr_triples_2
β β ββ ent_ids_1
β β ββ ent_ids_2
β β ββ ent_links
β β ββ ill_ent_ids
β β ββ rel_ids
β β ββ rel_triples_1
β β ββ rel_triples_2
β β ββ triples_1
β β ββ triples_2
β ββ pkl
β β ββ OEA_D_W_15K_V1_id_img_feature_dict.pkl
β β ββ OEA_D_W_15K_V2_id_img_feature_dict.pkl
β β ββ OEA_EN_DE_15K_V1_id_img_feature_dict.pkl
β β ββ OEA_EN_FR_15K_V1_id_img_feature_dict.pkl
β ββ data.py
ββ dump
ββ embedding
β ββ dbp_fr_en_char.pkl
β ββ dbp_fr_en_name.pkl
β ββ dbp_ja_en_char.pkl
β ββ dbp_ja_en_name.pkl
β ββ dbp_zh_en_char.pkl
β ββ dbp_zh_en_name.pkl
β ββ glove.6B.300d.txt
ββ pkls
ββ FBDB15K_id_img_feature_dict.pkl
ββ FBYG15K_id_img_feature_dict.pkl
ββ dbpedia_wikidata_15k_dense_GA_id_img_feature_dict.pkl
ββ dbpedia_wikidata_15k_norm_GA_id_img_feature_dict.pkl
ββ fr_en_GA_id_img_feature_dict.pkl
ββ ja_en_GA_id_img_feature_dict.pkl
ββ zh_en_GA_id_img_feature_dict.pkl
</details>
π€ Cite:
Please condiser citing this paper if you use the code
or data
from our work.
Thanks a lot :)
@article{DBLP:journals/corr/abs-2402-11000,
author = {Yangyifei Luo and
Zhuo Chen and
Lingbing Guo and
Qian Li and
Wenxuan Zeng and
Zhixin Cai and
Jianxin Li},
title = {{ASGEA:} Exploiting Logic Rules from Align-Subgraphs for Entity Alignment},
journal = {CoRR},
volume = {abs/2402.11000},
year = {2024}
}