Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
luigiba committed Sep 6, 2019
1 parent 29bf2db commit 9d73821
Show file tree
Hide file tree
Showing 7 changed files with 258 additions and 32 deletions.
12 changes: 3 additions & 9 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

250 changes: 248 additions & 2 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion colab/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ os.environ["LIB_CUDA"] = "/usr/local/cuda-10.0/lib64"
os.environ["WORK_DIR_PREFIX"] = "/content/OpenKEonSpark"
os.environ["SPARK_HOME"] = "/content/spark-2.1.1-bin-hadoop2.7"

#execute
#execute train-evaluate pipeline
!bash $WORK_DIR_PREFIX/colab/run_dbpedia.sh 10 64 "TransE" 0.00001


Expand Down
13 changes: 1 addition & 12 deletions colab/run_dbpedia.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
#this is an example of script that can be used on google colab to train the embedding and evaluate them
# the link prediction evaluation will be performed only for the last batch
# for the other batch it will be performed only triple classification evaluation
#before starting the script:
# run split.py to set the dataset in a properly format
# set environment variables, e.g.:
# $JAVA_HOME = "/usr/lib/jvm/java-8-openjdk-amd64"
# $SPARK_WORKER_INSTANCES = '3'
# $PYSPARK_PYTHON = '/usr/bin/python3'
# $CUDA_VISIBLE_DEVICES = "0"
# $CORES_PER_WORKER = "1"
# $MEMORY_PER_WORKER = "4g"
# $LIB_CUDA = "/usr/local/cuda-10.0/lib64"
# $WORK_DIR_PREFIX = "/content/OpenKEonSpark"
# $SPARK_HOME = "/content/spark-2.1.1-bin-hadoop2.7"
#before starting the script: run the commands in commands.txt


echo "====================================== Parameters ======================================"
Expand Down
6 changes: 3 additions & 3 deletions main_spark.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ def n_n():
parser.add_argument("--ent_dimension", help="entities embedding dimension", type=int, default=0)
parser.add_argument("--rel_dimension", help="relations embedding dimension", type=int, default=0)
parser.add_argument("--ent_neg_rate", help="number of negative triples generated by corrupting the entity", type=int, default=1)
parser.add_argument("--rel_neg_rate", help="number of negative triples generated by corrupting the realtion", type=int, default=0)
parser.add_argument("--optimizer", help="Optimization algorithm", type=str, default="SGD")
parser.add_argument("--rel_neg_rate", help="number of negative triples generated by corrupting the relation", type=int, default=0)
parser.add_argument("--optimizer", help="Optimization algorithm (SGD/Adam)", type=str, default="SGD")
parser.add_argument("--early_stop_patience", help="no. epochs to wait for accuracy/loss improvement before early stop", type=int, default=5)
parser.add_argument("--early_stop_stopping_step", help="perfrom early stop each stopping step", type=int, default=1)
parser.add_argument("--early_stop_start_step", help="perfrom early stop from start step", type=int, default=1)
parser.add_argument("--model", help="model to be used", type=str, default="TransE")
parser.add_argument("--model", help="model to be used (TransE/TransH/TransR/TransD)", type=str, default="TransE")
parser.add_argument("--debug", help="if Ture prints additional debug information", type=bool, default=True)
parser.add_argument("--mode", help="whether to perform train or evaluation mode", type=str, default="train")
parser.add_argument("--test_head", help="perform link prediction evaluation on missing head, too (only if mode != 'train'); 0=False, n=True", type=int, default=0)
Expand Down
3 changes: 0 additions & 3 deletions split/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
percentage of triples with target relation/s for each batch test set
VALIDATION_SET_PERCENTAGE
percentage of triples with target relation/s for each batch validation set
"""

import math
Expand Down
4 changes: 2 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
dataset_path = sys.argv[1]
model_path = sys.argv[2]
cpp_path = sys.argv[3]
dim = sys.argv[3]
model = sys.argv[4]
dim = sys.argv[4]
model = sys.argv[5]
if (len(sys.argv) >= 7): target_rel_index = sys.argv[6]


Expand Down

0 comments on commit 9d73821

Please sign in to comment.