Skip to content

Commit c7a1f01

Browse files
Neural-Link Teamtensorflow-copybara
authored andcommitted
internal
PiperOrigin-RevId: 307136389
1 parent 6127e84 commit c7a1f01

File tree

10 files changed

+38
-38
lines changed

10 files changed

+38
-38
lines changed

research/kg_hyp_emb/README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ Euclidean embeddings:
1919
* CTDecomp [2]
2020
* TransE [4]
2121
* MurE [5]
22-
* RotE [6]
23-
* RefE [6]
24-
* AttE [6]
22+
* RotE (new)
23+
* RefE (new)
24+
* AttE (new)
2525

2626
Hyperbolic embeddings:
2727

28-
* TransH [6]
29-
* RotH [6]
30-
* RefH [6]
31-
* AttH [6]
28+
* TransH (new)
29+
* RotH (new)
30+
* RefH (new)
31+
* AttH (new)
3232

3333
## Usage
3434

@@ -73,7 +73,7 @@ RefE on FB15k-237:
7373
python train.py --max_epochs 100 --dataset FB237 --model RefE --loss_fn SigmoidCrossEntropy --neg_sample_size -1 --data_dir data --optimizer Adagrad --lr 5e-2 --save_dir logs --rank 500 --entity_reg 1e-5 --rel_reg 1e-5 --patience 10 --valid 5 --save_model=false --save_logs=true --regularizer L3 --initializer GlorotNormal
7474
```
7575

76-
This model achieves 54% Hits@10 on the FB237 test set.
76+
This model should achieve around 54% Hits@10 on the FB237 test set.
7777

7878
## References
7979

@@ -93,4 +93,5 @@ multi-relational data." Advances in neural information processing systems. 2013.
9393
[5] Balažević, Ivana, et al. "Multi-relational Poincaré Graph Embeddings."
9494
Advances in neural information processing systems. 2019.
9595

96-
[6] Chami, Ines, et al. "Low-Dimensional Hyperbolic Knowledge Graph Embeddings." Annual Meeting of the Association for Computational Linguistics. 2020.
96+
[6] Chami, Ines, et al. Low-Dimensional Hyperbolic Knowledge Graph Embeddings.
97+
Under submission. 2019.

research/kg_hyp_emb/learning/trainer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
"""Module to train knowledge graph embedding models."""
1515

16-
from kg_hyp_emb.learning import losses
16+
from kgemb.learning import losses
1717
import tensorflow as tf
1818

1919

research/kg_hyp_emb/models/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# limitations under the License.
1414
"""Knowledge graph embedding models."""
1515

16-
from kg_hyp_emb.models.complex import Complex
17-
from kg_hyp_emb.models.complex import RotatE
18-
from kg_hyp_emb.models.euclidean import AttE
19-
from kg_hyp_emb.models.euclidean import CTDecomp
20-
from kg_hyp_emb.models.euclidean import MurE
21-
from kg_hyp_emb.models.euclidean import RefE
22-
from kg_hyp_emb.models.euclidean import RotE
23-
from kg_hyp_emb.models.euclidean import TransE
24-
from kg_hyp_emb.models.hyperbolic import AttH
25-
from kg_hyp_emb.models.hyperbolic import RefH
26-
from kg_hyp_emb.models.hyperbolic import RotH
27-
from kg_hyp_emb.models.hyperbolic import TransH
16+
from kgemb.models.complex import Complex
17+
from kgemb.models.complex import RotatE
18+
from kgemb.models.euclidean import AttE
19+
from kgemb.models.euclidean import CTDecomp
20+
from kgemb.models.euclidean import MurE
21+
from kgemb.models.euclidean import RefE
22+
from kgemb.models.euclidean import RotE
23+
from kgemb.models.euclidean import TransE
24+
from kgemb.models.hyperbolic import AttH
25+
from kgemb.models.hyperbolic import RefH
26+
from kgemb.models.hyperbolic import RotH
27+
from kgemb.models.hyperbolic import TransH

research/kg_hyp_emb/models/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import abc
2121

22-
from kg_hyp_emb.learning import regularizers
22+
from kgemb.learning import regularizers
2323
import numpy as np
2424
import tensorflow as tf
2525

research/kg_hyp_emb/models/complex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from __future__ import division
1818
from __future__ import print_function
1919

20-
from kg_hyp_emb.models.base import KGModel
20+
from kgemb.models.base import KGModel
2121
import tensorflow as tf
2222

2323

research/kg_hyp_emb/models/euclidean.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
from __future__ import division
1818
from __future__ import print_function
1919

20-
from kg_hyp_emb.models.base import KGModel
21-
from kg_hyp_emb.utils import euclidean as euc_utils
20+
from kgemb.models.base import KGModel
21+
from kgemb.utils import euclidean as euc_utils
2222
import numpy as np
2323
import tensorflow as tf
2424

research/kg_hyp_emb/models/hyperbolic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
from __future__ import division
1818
from __future__ import print_function
1919

20-
from kg_hyp_emb.models.base import KGModel
21-
from kg_hyp_emb.utils import euclidean as euc_utils
22-
from kg_hyp_emb.utils import hyperbolic as hyp_utils
20+
from kgemb.models.base import KGModel
21+
from kgemb.utils import euclidean as euc_utils
22+
from kgemb.utils import hyperbolic as hyp_utils
2323
import numpy as np
2424
import tensorflow as tf
2525

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
absl-py
2-
numpy
3-
tensorflow-gpu==2.0
1+
numpy>=1.17
2+
tensorflow_gpu>=2.0.0

research/kg_hyp_emb/train.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
from absl import flags
3030
from absl import logging
3131

32-
from kg_hyp_emb.config import CONFIG
33-
from kg_hyp_emb.datasets.datasets import DatasetFn
34-
from kg_hyp_emb.learning.trainer import KGTrainer
35-
import kg_hyp_emb.models as models
36-
import kg_hyp_emb.utils.train as train_utils
32+
from kgemb.config import CONFIG
33+
from kgemb.datasets.datasets import DatasetFn
34+
from kgemb.learning.trainer import KGTrainer
35+
import kgemb.models as models
36+
import kgemb.utils.train as train_utils
3737
import tensorflow as tf
3838

3939
flag_fns = {

research/kg_hyp_emb/utils/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from __future__ import print_function
1919

2020
from absl import flags
21-
from kg_hyp_emb.config import CONFIG
21+
from kgemb.config import CONFIG
2222
import numpy as np
2323

2424
FLAGS = flags.FLAGS

0 commit comments

Comments
 (0)