All Projects → mana-ysh → Knowledge Graph Embeddings

mana-ysh / Knowledge Graph Embeddings

Licence: apache-2.0
Implementations of Embedding-based methods for Knowledge Base Completion tasks

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Knowledge Graph Embeddings

Nlp4rec Papers
Paper list of NLP for recommender systems
Stars: ✭ 162 (-28%)
Mutual labels:  knowledge-graph
Kbgan
Code for "KBGAN: Adversarial Learning for Knowledge Graph Embeddings" https://arxiv.org/abs/1711.04071
Stars: ✭ 186 (-17.33%)
Mutual labels:  knowledge-graph
Degdb
degdb: distributed economic graph database
Stars: ✭ 207 (-8%)
Mutual labels:  knowledge-graph
Aser
ASER (activities, states, events, and their relations), a large-scale eventuality knowledge graph extracted from more than 11-billion-token unstructured textual data.
Stars: ✭ 171 (-24%)
Mutual labels:  knowledge-graph
One Shot Relational Learning
Code for One-shot Relational Learning for Knowledge Graphs (EMNLP18)
Stars: ✭ 178 (-20.89%)
Mutual labels:  knowledge-graph
Agriculture Knowledgegraph Data
对知识库Wikidata的爬虫以及数据处理脚本 将三元组关系对齐到语料库的脚本 获取知识图谱数据的脚本
Stars: ✭ 198 (-12%)
Mutual labels:  knowledge-graph
Nspm
🤖 Neural SPARQL Machines for Knowledge Graph Question Answering.
Stars: ✭ 156 (-30.67%)
Mutual labels:  knowledge-graph
Kprn
Reasoning Over Knowledge Graph Paths for Recommendation
Stars: ✭ 220 (-2.22%)
Mutual labels:  knowledge-graph
Crslab
CRSLab is an open-source toolkit for building Conversational Recommender System (CRS).
Stars: ✭ 183 (-18.67%)
Mutual labels:  knowledge-graph
Minerva
Meandering In Networks of Entities to Reach Verisimilar Answers
Stars: ✭ 205 (-8.89%)
Mutual labels:  knowledge-graph
Nexus
Blue Brain Nexus - A knowledge graph for data-driven science
Stars: ✭ 173 (-23.11%)
Mutual labels:  knowledge-graph
Mmkb
Several data modalities for KBs (visual, numerical, temporal, etc.)
Stars: ✭ 178 (-20.89%)
Mutual labels:  knowledge-graph
Awesome Network Embedding
A curated list of network embedding techniques.
Stars: ✭ 2,379 (+957.33%)
Mutual labels:  knowledge-graph
Topic Db
TopicDB is a topic maps-based semantic graph store (using PostgreSQL for persistence)
Stars: ✭ 164 (-27.11%)
Mutual labels:  knowledge-graph
Knowledge Graph Analysis Programming Exercises
Exercises for the Analysis of Knowledge Graphs
Stars: ✭ 208 (-7.56%)
Mutual labels:  knowledge-graph
Entity2rec
entity2rec generates item recommendation using property-specific knowledge graph embeddings
Stars: ✭ 159 (-29.33%)
Mutual labels:  knowledge-graph
Awesome Kgqa
A collection of some materials of knowledge graph question answering
Stars: ✭ 188 (-16.44%)
Mutual labels:  knowledge-graph
Bert Attributeextraction
USING BERT FOR Attribute Extraction in KnowledgeGraph. fine-tuning and feature extraction. 使用基于bert的微调和特征提取方法来进行知识图谱百度百科人物词条属性抽取。
Stars: ✭ 224 (-0.44%)
Mutual labels:  knowledge-graph
Mkr
A tensorflow implementation of MKR (Multi-task Learning for Knowledge Graph Enhanced Recommendation)
Stars: ✭ 216 (-4%)
Mutual labels:  knowledge-graph
Multihopkg
Multi-hop knowledge graph reasoning learned via policy gradient with reward shaping and action dropout
Stars: ✭ 202 (-10.22%)
Mutual labels:  knowledge-graph

knowledge-graph-embeddings

Python Implementations of Embedding-based methods for Knowledge Base Completion tasks, mainly inspired by scikit-kge and complex.

List of methods

  • RESCAL [Nickel+. 2011]
  • TransE [Bordes+. 2013]
  • DistMult [Yang+. 2015]
  • HolE [Nicklel+. 2016]
    • This model is equivalent to ComplEx[Hayashi and Shimbo. 2018], and the computation cost of ComplEx is lower than of HolE.
  • ComplEx [Trouillon+. 2016]
  • ANALOGY [Liu+. 2017]
    • This model can be regarded as a hybrid between DistMult and ComplEx.

Run to train and test

For training...

▶  python train.py -h
usage: Link prediction models [-h] [--mode MODE] [--ent ENT] [--rel REL]
                              [--train TRAIN] [--valid VALID]
                              [--method METHOD] [--epoch EPOCH]
                              [--batch BATCH] [--lr LR] [--dim DIM]
                              [--margin MARGIN] [--negative NEGATIVE]
                              [--opt OPT] [--l2_reg L2_REG]
                              [--gradclip GRADCLIP] [--save_step SAVE_STEP]
                              [--cp_ratio CP_RATIO] [--metric METRIC]
                              [--nbest NBEST] [--filtered]
                              [--graphall GRAPHALL] [--log LOG]

optional arguments:
  -h, --help            show this help message and exit
  --mode MODE           training mode ["pairwise", "single"]
  --ent ENT             entity list
  --rel REL             relation list
  --train TRAIN         training data
  --valid VALID         validation data
  --method METHOD       method ["complex", "distmult", "transe", "hole",
                        "rescal", "analogy"]
  --epoch EPOCH         number of epochs
  --batch BATCH         batch size
  --lr LR               learning rate
  --dim DIM             dimension of embeddings
  --margin MARGIN       margin in max-margin loss for pairwise training
  --negative NEGATIVE   number of negative samples for pairwise training
  --opt OPT             optimizer ["sgd", "adagrad"]
  --l2_reg L2_REG       L2 regularization
  --gradclip GRADCLIP   gradient clipping
  --save_step SAVE_STEP
                        epoch step for saving model
  --cp_ratio CP_RATIO   ratio of complex's dimention in ANALOGY
  --metric METRIC       evaluation metrics ["mrr", "hits"]
  --nbest NBEST         n-best for hits metric
  --filtered            use filtered metric
  --graphall GRAPHALL   all graph file for filtered evaluation
  --log LOG             output log dir

For testing...

▶  python test.py -h
usage: Link prediction models [-h] [--ent ENT] [--rel REL] [--data DATA]
                              [--filtered] [--graphall GRAPHALL]
                              [--method METHOD] [--model MODEL]

optional arguments:
  -h, --help           show this help message and exit
  --ent ENT            entity list
  --rel REL            relation list
  --data DATA          test data
  --filtered           use filtered metric
  --graphall GRAPHALL  all graph file for filtered evaluation
  --method METHOD      method ["complex", "distmult", "transe", "hole",
                       "rescal", "analogy"]
  --model MODEL        trained model path

Experiments

WordNet (WN18)

Models MRR (flt) MRR (raw) [email protected] (flt) [email protected] (flt) [email protected] (flt)
ComplEx* 94.1 58.7 93.6 94.5 94.7
ComplEx 94.3 58.2 94.0 94.6 94.8

hyper parameters

  • mode : single
  • epoch : 500
  • batch : 128
  • lr : 0.05
  • dim : 200
  • negative : 5
  • opt : adagrad
  • l2_reg : 0.001
  • gradclip : 5

FreeBase (FB15k)

Models MRR (flt) MRR (raw) [email protected] (flt) [email protected] (flt) [email protected] (flt)
ComplEx* 69.2 24.2 59.9 75.9 84.0
ComplEx 69.5 24.2 59.8 76.9 85.0

hyper parameters

  • mode : single
  • epoch : 500
  • batch : 128
  • lr : 0.05
  • dim : 200
  • negative : 10
  • opt : adagrad
  • l2_reg : 0.0001
  • gradclip : 5

* means the results reported from the original papers

Dependencies

  • numpy
  • scipy

References

  • Bordes, A.; Usunier, N.; Garcia-Duran, A.; Weston, J.; and Yakhnenko, O. 2013. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems (NIPS).

  • Liu, H.; Wu, Y.; and Yang, Y. 2017. Analogical inference for multi-relational embeddings. In Proceedings of the 34th International Conference on Machine Learning (ICML).

  • Nickel, M.; Rosasco, L.; and Poggio, T. 2016. Holographic embeddings of knowledge graphs. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16.

  • Nickel, M.; Tresp, V.; and Kriegel, H.-P. 2011. A threeway model for collective learning on multi-relational data. In International Conference on Machine Learning (ICML-11), ICML ’11,

  • Trouillon, T.; Welbl, J.; Riedel, S.; Gaussier, E.; and Bouchard, G. 2016. Complex embeddings for simple link prediction. In International Conference on Machine Learning (ICML).

  • Yang, B.; Yih, W.; He, X.; Gao, J.; and Deng, L. 2015. Embedding entities and relations for learning and inference in knowledge bases. International Conference on Learning Representations 2015.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].