Skip to content

SuLab/KnowledgeGraphEmbedding

Repository files navigation

Drug Repuprosing using Consilience of Knowledge Graph Completion Methods

This repository is a fork of Sun et. al implementation of four knowledge graph embedding models. Here we apply the aforementioned algorithms to a biomedical knowledge graph called MIND (MechRepoNet with DrugCentralindications). We report the results of our analysis in this preprint.

Modifications to the original repository

  • Added code to output raw embeddings in order to extract predictions. This can be seen with the --do_predict flag in codes/run.py.
  • Added Notebooks folder that encapsulates analysis done on the MIND dataset.
  • Added methods, Notebooks/score_utils.py, to process and translate raw embeddings into human readable entities and relations.

Usage instructions

  1. Please see the original PyTorch implementation instructions
  2. Download the MIND dataset to ./data
  3. Install requirements into python virtual environment
    # run in shell mamba create -f environment.yml mamba activate kge 
  4. Train/Test
    # run in shell bash run.sh train <model_name> <dataset_name> <gpu_num> <folder_out_name> <batch size> <neg_sample_size> <dimensions> <gamma> <alpha> <learningrate> <test_batch_size> <double_entities_emb> <double_relation_emb> <regularization> # or in python # for more parameters please see codes/run.py Lines 23 - 72 python run.py --{do_train, do_valid, do_test, do_predict} --data_path <where/data/is> --model{TransE, DistMult, ComplEx, RotatE} 

Citation

If you use the codes, please cite the original paper by Sun et al:

@inproceedings{sun2018rotate, title={RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space}, author={Zhiqing Sun and Zhi-Hong Deng and Jian-Yun Nie and Jian Tang}, booktitle={International Conference on Learning Representations}, year={2019}, url={https://openreview.net/forum?id=HkgEQnRqYQ}, } 

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook99.8%
  • Other0.2%