Skip to content

Commit a7e065e

Browse files
committed
update README
1 parent ae56d53 commit a7e065e

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

research/kg_hyp_emb/README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
This project is a Tensorflow 2.0 implementation of Hyperbolic KG embeddings [6]
44
as well as multiple state-of-the-art KG embedding models which can be trained
5-
for the link prediction task.
5+
for the link prediction task. A PyTorch implementation is also available at: [https://github.com/HazyResearch/KGEmb](https://github.com/HazyResearch/KGEmb)
66

77
## Library Overview
88

99
This implementation includes the following models:
1010

11-
Complex embeddings:
11+
#### Complex embeddings:
1212

1313
* Complex [1]
1414
* Complex-N3 [2]
1515
* RotatE [3]
1616

17-
Euclidean embeddings:
17+
#### Euclidean embeddings:
1818

1919
* CTDecomp [2]
2020
* TransE [4]
@@ -23,14 +23,14 @@ Euclidean embeddings:
2323
* RefE [6]
2424
* AttE [6]
2525

26-
Hyperbolic embeddings:
26+
#### Hyperbolic embeddings:
2727

2828
* TransH [6]
2929
* RotH [6]
3030
* RefH [6]
3131
* AttH [6]
3232

33-
## Usage
33+
## Installation
3434

3535
First, create a python 3.7 environment and install dependencies: From kgemb/
3636

@@ -66,6 +66,8 @@ KG_DIR=$(pwd)/..
6666
export PYTHONPATH="$KG_DIR:$PYTHONPATH"
6767
```
6868

69+
## Example usage
70+
6971
Then, train a model using the `train.py` script. We provide an example to train
7072
RefE on FB15k-237:
7173

@@ -75,6 +77,26 @@ python train.py --max_epochs 100 --dataset FB237 --model RefE --loss_fn SigmoidC
7577

7678
This model achieves 54% Hits@10 on the FB237 test set.
7779

80+
## New models
81+
82+
To add a new (complex/hyperbolic/Euclidean) Knowledge Graph embedding model, implement the corresponding query embedding under models/, e.g.:
83+
84+
```
85+
def get_queries(self, input_tensor):
86+
entity = self.entity(input_tensor[:, 0])
87+
rel = self.rel(input_tensor[:, 1])
88+
result = ### Do something here ###
89+
return return result
90+
```
91+
92+
## Citation
93+
94+
If you use the codes, please cite the following paper [6]:
95+
96+
```
97+
TODO: add bibtex
98+
```
99+
78100
## References
79101

80102
[1] Trouillon, Théo, et al. "Complex embeddings for simple link prediction."
@@ -95,3 +117,4 @@ Advances in neural information processing systems. 2019.
95117

96118
[6] Chami, Ines, et al. "Low-Dimensional Hyperbolic Knowledge Graph Embeddings."
97119
Annual Meeting of the Association for Computational Linguistics. 2020.
120+

0 commit comments

Comments
 (0)