The code for our paper "AutoSF: Searching Scoring Functions for Knowledge Graph Embedding"

Overview

AutoSF

The code for our paper "AutoSF: Searching Scoring Functions for Knowledge Graph Embedding" and this paper has been accepted by ICDE2020.

News: (2021.4) AutoSF-OGB for Open Graph Benchmark is released.

Readers are welcomed to fork this repository to reproduce the experiments and follow our work. Please kindly cite our paper

@inproceedings{zhang2019autosf,
  title={AutoSF: Searching Scoring Functions for Knowledge Graph Embedding},
  author={Zhang, Yongqi and Yao, Quanming and Dai, Wenyuan and Chen, Lei},
  booktitle={2020 IEEE 36th International Conference on Data Engineering (ICDE)},
  pages={433--444},
  year={2020},
  organization={IEEE}
}

Instructions

For the sake of ease, a quick instruction is given for readers to reproduce the whole process. Note that the programs are tested on Linux(Ubuntu release 16.04), Python 3.7 from Anaconda 4.5.11.

Install PyTorch (>0.4.0)

conda install pytorch -c pytorch

Get this repo

git clone https://github.com/yzhangee/AutoSF
cd AutoSF
tar -zvxf KG_Data.tar.gz 

Reproducing the searching/fine-tuning/evaluation procedure, please refer to the bash file "run.sh"

bash run.sh

Explaination of the searched SFs in the file "searched_SFs.txt":

  • The first 4 values (a,b,c,d) represent h_1 * r_1 * t_a + h_2 * r_2 * t_b + h_3 * r_3 * t_c + h_4 * r_4 * t_d.

  • For the others, every 4 values represent one adding block: index of r, index of h, index of t, the sign s.

You can also rely on the "evaluate.py" file to evaluate the searched SFs by manually setting the struct variable.

Related AutoML papers (ML Research group in 4Paradigm)

  • Interstellar: Searching Recurrent Architecture for Knowledge Graph Embedding. NeurIPS 2020 papercode
  • Efficient Neural Interaction Functions Search for Collaborative Filtering. WWW 2020 paper code
  • Efficient Neural Architecture Search via Proximal Iterations. AAAI 2020. paper code
  • Simple and Automated Negative Sampling for Knowledge Graph Embedding. ICDE 2019 paper code
  • Taking Human out of Learning Applications: A Survey on Automated Machine Learning. Arxiv 2018 paper
Comments
  • I try to rerun this CODE, but there is a question.

    I try to rerun this CODE, but there is a question.

    File "D:\onedrive\OneDrive - whu.edu.cn\PAPER CODE\AutoSF\AutoSF-master\base_model.py", line 77, in train return best_mrr, best_str UnboundLocalError: local variable 'best_str' referenced before assignment

    opened by brucelee19960413 8
  • training time - program seems to hang

    training time - program seems to hang

    Hi, I'm trying to reproduce your work, I'm using 4 GeForce RTX with 10G of memory. But after few minutes, the training seems to hang.

     python train.py --task_dir KG_Data/WN18 --optim adagrad --lamb 0.000282 --lr 0.37775 --n_dim 64 --n_epoch 250 --n_batch 1024 --epoch_per_test 50 --test_batch_size 50 --thres 0.0 --parrel 5 --decay_rate 0.99456
    B=4 Iter 1      sampled 5 candidate state for evaluate 12929
    new: 0 [3 2 0 1] 4
    new: 1 [0 2 1 3] 4
    new: 2 [2 1 3 0] 4
    new: 3 [2 3 0 1] 4
    new: 4 [0 1 2 3] 4
    
    

    nvidia-smi only shows a 1821MB memory used. So i guessed it's not the GPU How long do you think the training takes?

    Thanks

    opened by jpainam 6
  • Error for multiprocessing

    Error for multiprocessing

    Hi, I am using two 1080Ti for the training and set the --parrel as 2 (update: even 1 would cause same problem) However, I get the bellow error although I notice "best_score = 0" in line 94 of train.py, any idea to fix it? Thanks!

    B=4 Iter 1 sampled 5 candidate state for evaluate 12846 newID: 1 newID: 0 [2 3 0 1] 4 [3 2 0 1] 4 newID: 2 [0 1 2 3] 4 newID: 3 [1 3 2 0] 4 newID: 4 [0 2 1 3] 4 ~~~~~~~~~~~~~~ parallelly train B=4 finished~~~~~~~~~~~~~~ 0 multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "~/.conda/envs/dgl-ke/lib/python3.8/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "~/AutoSF/train.py", line 66, in run_model best_mrr, best_str = model.train(train_data, tester_val, tester_tst) File "~/AutoSF/base_model.py", line 79, in train return best_mrr, best_str UnboundLocalError: local variable 'best_str' referenced before assignment """

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last): File "~/AutoSF/train.py", line 155, in scor = score.get() File "~/.conda/envs/dgl-ke/lib/python3.8/multiprocessing/pool.py", line 771, in get raise self._value UnboundLocalError: local variable 'best_str' referenced before assignment

    opened by Luckick 4
  • Hyperparameters for reproducing results on ogbl-biokg

    Hyperparameters for reproducing results on ogbl-biokg

    Hi there,

    I am trying to reproduce the results you have on the ogbl-biokg knowledge graph. You name some tuned hyperparameters in the README and I am a bit confused about that. Since there are multiple values for each hyperparameter given there, I am not sure which one of those is the one that was found to deliver the best result. Did you do a grid search over them? And if you did, could you possibly share the code? Since right now, I am not able to reproduce the scoring results when I run the examples.sh script.

    Thanks in advance!

    Best,

    Sophia

    opened by sophiakrix 1
  • How to explicitly re-evaluate the model using the best scoring function

    How to explicitly re-evaluate the model using the best scoring function

    @yzhangee @quanmingyao @skeletondyh Hi, I'm having a problemp similar to #2

    1. After training with bash run.sh, I get the following results saved in WN18_perf.txt file as
    1 2 0 3 		best_performance: 0.7187	0.8277		0.7131	0.8213
    3 0 1 2 		best_performance: 0.7884	0.8459		0.7877	0.8470
    1 0 2 3 		best_performance: 0.9488	0.9533		0.9488	0.9548
    2 3 0 1 		best_performance: 0.9486	0.9541		0.9490	0.9565
    0 1 2 3 		best_performance: 0.8099	0.9466		0.8128	0.9503
    2 3 0 1 2 3 3 1 0 2 2 1 		best_performance: 0.9482	0.9534		0.9483	0.9546
    2 3 0 1 2 3 3 -1 2 2 2 1 		best_performance: 0.9454	0.9536		0.9450	0.9542
    etc..
    

    I would like to know what these numbers (e.g. 0.9454 0.9536 0.9450 0.9542) represent? Do they represent the hit? I your paper, you reported the MRR, H@1 and the H@10. But here, i see four numbers for each function. image

    1. It is possible to only test the model using the obtained scoring function f(h,r,t) for evaluation. It will be good if you can add in the read me the command to only test the model by specifying a scoring function

    Thanks

    opened by jpainam 1
  • OGB model documentation

    OGB model documentation

    Good evening. I have a question , regarding your code for the ogb wikidata. I've been working on graph neural networks lately, but because it's something new to me I'm having difficulties. Could I find somewhere documentation for the code and more specifically for the methods.Thanks in advance.

    opened by Percefoni 1
  • How to get the triplet classification result?

    How to get the triplet classification result?

    Hi, I'm very interested in this meaningful work. And I notice that the triplet classification result is shown in the paper "AutoSF: Searching Scoring Functions for Knowledge Graph Embedding". But it does not seem to exist in this repository.

    opened by ideafang 1
Owner
AutoML Research
A compact machine learning research group focusing on automated machine learning (AutoML), meta-learning and neural architecture search (NAS).
AutoML Research
PyTorch implementation of our Adam-NSCL algorithm from our CVPR2021 (oral) paper "Training Networks in Null Space for Continual Learning"

Adam-NSCL This is a PyTorch implementation of Adam-NSCL algorithm for continual learning from our CVPR2021 (oral) paper: Title: Training Networks in N

Shipeng Wang 34 Dec 21, 2022
Convolutional neural network web app trained to track our infant’s sleep schedule using our Google Nest camera.

Machine Learning Sleep Schedule Tracker What is it? Convolutional neural network web app trained to track our infant’s sleep schedule using our Google

g-parki 7 Jul 15, 2022
Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

CoProtector Code for the prototype tool in our paper "CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoning".

Zhensu Sun 1 Oct 26, 2021
Code for our method RePRI for Few-Shot Segmentation. Paper at http://arxiv.org/abs/2012.06166

Region Proportion Regularized Inference (RePRI) for Few-Shot Segmentation In this repo, we provide the code for our paper : "Few-Shot Segmentation Wit

Malik Boudiaf 138 Dec 12, 2022
Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks

SA-Net: Shuffle Attention for Deep Convolutional Neural Networks (paper) By Qing-Long Zhang and Yu-Bin Yang [State Key Laboratory for Novel Software T

Qing-Long Zhang 199 Jan 8, 2023
Code for our CVPR 2021 paper "MetaCam+DSCE"

Joint Noise-Tolerant Learning and Meta Camera Shift Adaptation for Unsupervised Person Re-Identification (CVPR'21) Introduction Code for our CVPR 2021

FlyingRoastDuck 59 Oct 31, 2022
Code for our CVPR2021 paper coordinate attention

Coordinate Attention for Efficient Mobile Network Design (preprint) This repository is a PyTorch implementation of our coordinate attention (will appe

Qibin (Andrew) Hou 726 Jan 5, 2023
[CVPR2021] The source code for our paper 《Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Learning》.

TBE The source code for our paper "Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Le

Jinpeng Wang 150 Dec 28, 2022
Code for our paper at ECCV 2020: Post-Training Piecewise Linear Quantization for Deep Neural Networks

PWLQ Updates 2020/07/16 - We are working on getting permission from our institution to release our source code. We will release it once we are granted

null 54 Dec 15, 2022
Code for our paper Domain Adaptive Semantic Segmentation with Self-Supervised Depth Estimation

CorDA Code for our paper Domain Adaptive Semantic Segmentation with Self-Supervised Depth Estimation Prerequisite Please create and activate the follo

Qin Wang 60 Nov 30, 2022
the code for our CVPR 2021 paper Bilateral Grid Learning for Stereo Matching Network [BGNet]

BGNet This repository contains the code for our CVPR 2021 paper Bilateral Grid Learning for Stereo Matching Network [BGNet] Environment Python 3.6.* C

3DCV developer 87 Nov 29, 2022
PyTorch code for our paper "Attention in Attention Network for Image Super-Resolution"

Under construction... Attention in Attention Network for Image Super-Resolution (A2N) This repository is an PyTorch implementation of the paper "Atten

Haoyu Chen 71 Dec 30, 2022
Code for reproducing our analysis in the paper titled: Image Cropping on Twitter: Fairness Metrics, their Limitations, and the Importance of Representation, Design, and Agency

Image Crop Analysis This is a repo for the code used for reproducing our Image Crop Analysis paper as shared on our blog post. If you plan to use this

Twitter Research 239 Jan 2, 2023
Code for our ACL 2021 paper - ConSERT: A Contrastive Framework for Self-Supervised Sentence Representation Transfer

ConSERT Code for our ACL 2021 paper - ConSERT: A Contrastive Framework for Self-Supervised Sentence Representation Transfer Requirements torch==1.6.0

Yan Yuanmeng 478 Dec 25, 2022
code for our paper "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer"

SHOT++ Code for our TPAMI submission "Source Data-absent Unsupervised Domain Adaptation through Hypothesis Transfer and Labeling Transfer" that is ext

null 75 Dec 16, 2022
Code for our paper "SimCLS: A Simple Framework for Contrastive Learning of Abstractive Summarization", ACL 2021

SimCLS Code for our paper: "SimCLS: A Simple Framework for Contrastive Learning of Abstractive Summarization", ACL 2021 1. How to Install Requirements

Yixin Liu 150 Dec 12, 2022
Code for our paper "Sematic Representation for Dialogue Modeling" in ACL2021

AMR-Dialogue An implementation for paper "Semantic Representation for Dialogue Modeling". You may find our paper here. Requirements python 3.6 pytorch

xfbai 45 Dec 26, 2022
Code for our ACL 2021 paper "One2Set: Generating Diverse Keyphrases as a Set"

One2Set This repository contains the code for our ACL 2021 paper “One2Set: Generating Diverse Keyphrases as a Set”. Our implementation is built on the

Jiacheng Ye 63 Jan 5, 2023
Code for our TKDE paper "Understanding WeChat User Preferences and “Wow” Diffusion"

wechat-wow-analysis Understanding WeChat User Preferences and “Wow” Diffusion. Fanjin Zhang, Jie Tang, Xueyi Liu, Zhenyu Hou, Yuxiao Dong, Jing Zhang,

null 18 Sep 16, 2022