Skip to content

Commit

Permalink
add the QuatE model and the OctonionE model
Browse files Browse the repository at this point in the history
  • Loading branch information
baxtree committed Nov 9, 2020
1 parent 4e143e0 commit 3aeca22
Show file tree
Hide file tree
Showing 9 changed files with 566 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ With pykg2vec command-line interface, you can
(pykg2vec) $ pykg2vec-train -mn TransE
# Train using different KGE methods.
(pykg2vec) $ pykg2vec-train -mn [TransE|TransD|TransH|TransG|TransM|TransR|Complex|ComplexN3|CP|RotatE|Analogy|
DistMult|KG2E|KG2E_EL|NTN|Rescal|SLM|SME|SME_BL|HoLE|ConvE|ConvKB|Proje_pointwise]
(pykg2vec) $ pykg2vec-train -mn [TransE|TransD|TransH|TransG|TransM|TransR|Complex|ComplexN3|
CP|RotatE|Analogy|DistMult|KG2E|KG2E_EL|NTN|Rescal|SLM|SME|SME_BL|HoLE|
ConvE|ConvKB|Proje_pointwise|MuRP|QuatE|OctonionE]
# For KGE using projection-based loss function, use more processes for batch generation.
(pykg2vec) $ pykg2vec-train -mn [ConvE|ConvKB|Proje_pointwise] -npg [the number of processes, 4 or 6]
Expand Down
5 changes: 3 additions & 2 deletions examples/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
- Train using different KGE methods. Check `Implemented KGE Algorithms`__ for more details: ::
$ python train.py -mn [TransE|TransD|TransH|TransG|TransM|TransR|Complex|ComplexN3|CP|RotatE|Analogy|
DistMult|KG2E|KG2E_EL|NTN|Rescal|SLM|SME|SME_BL|HoLE|ConvE|ConvKB|Proje_pointwise]
$ python train.py -mn [TransE|TransD|TransH|TransG|TransM|TransR|Complex|ComplexN3|
CP|RotatE|Analogy|DistMult|KG2E|KG2E_EL|NTN|Rescal|SLM|SME|SME_BL|HoLE|
ConvE|ConvKB|Proje_pointwise|MuRP|QuatE|OctonionE]
- For KGE using projection-based loss function, use more processes for batch generation: ::
Expand Down
5 changes: 4 additions & 1 deletion pykg2vec/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,11 @@ def __init__(self):
"hole": "pairwise.HoLE",
"distmult": "pointwise.DistMult",
"kg2e": "pairwise.KG2E",
"murp": "hyperbolic.MuRP",
"ntn": "pairwise.NTN",
"octonione": "pointwise.OctonionE",
"proje_pointwise": "projection.ProjE_pointwise",
"quate": "pointwise.QuatE",
"rescal": "pairwise.Rescal",
"rotate": "pairwise.RotatE",
"simple": "pointwise.SimplE",
Expand All @@ -279,7 +282,7 @@ def __init__(self):
"transm": "pairwise.TransM",
"transr": "pairwise.TransR",
"tucker": "projection.TuckER",
"murp": "hyperbolic.MuRP"}
}

def import_model_config(self, name):
"""This function imports models and configuration.
Expand Down
15 changes: 15 additions & 0 deletions pykg2vec/hyperparams/OctonionE.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
model_name: "OctonionE"
datasets:
- dataset: "freebase15k_237"
parameters:
learning_rate: 0.1
l1_flag: True
hidden_size: 50
batch_size: 100
epochs: 10000
margin: 1.0
optimizer: "adagrad"
sampling: "uniform"
neg_rate: 1
lmbda: 0.2
alpha: 0.1
57 changes: 57 additions & 0 deletions pykg2vec/hyperparams/QuatE.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
model_name: "QuatE"
datasets:
- dataset: "freebase15k_237"
parameters:
learning_rate: 0.1
l1_flag: True
hidden_size: 100
batch_size: 100
epochs: 15000
margin: 1.0
optimizer: "adagrad"
sampling: "uniform"
neg_rate: 1
lmbda: 0.2
alpha: 0.1

- dataset: "freebase15k"
parameters:
learning_rate: 0.1
l1_flag: True
hidden_size: 200
batch_size: 100
epochs: 5000
margin: 1.0
optimizer: "adagrad"
sampling: "uniform"
neg_rate: 1
lmbda: 0.1
alpha: 0.1

- dataset: "wordnet18_rr"
parameters:
learning_rate: 0.1
l1_flag: True
hidden_size: 100
batch_size: 100
epochs: 40000
margin: 1.0
optimizer: "adagrad"
sampling: "bern"
neg_rate: 1
lmbda: 0.1
alpha: 0.1

- dataset: "wordnet18"
parameters:
learning_rate: 0.1
l1_flag: True
hidden_size: 300
batch_size: 100
epochs: 3000
margin: 1.0
optimizer: "adagrad"
sampling: "bern"
neg_rate: 1
lmbda: 0.05
alpha: 0.1
Loading

0 comments on commit 3aeca22

Please sign in to comment.