Skip to content

Commit

Permalink
add comments for cen
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaGast committed May 31, 2024
1 parent b5b7077 commit 9a5cf5e
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
10 changes: 9 additions & 1 deletion examples/linkproppred/tkgl-icews/cen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_cuda, model_name, mode, split_mode):
"""
Test the model
:param model: model used to test
:param history_list: all input history snap shot list, not include output label train list or valid list
:param test_list: test triple snap shot list
Expand Down Expand Up @@ -101,7 +102,14 @@ def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_c

def run_experiment(args, trainvalidtest_id=0, n_hidden=None, n_layers=None, dropout=None, n_bases=None):
'''
trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
Run experiment for CEN model
:param args: arguments for the model
:param trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
:param n_hidden: number of hidden units
:param n_layers: number of layers
:param dropout: dropout rate
:param n_bases: number of bases
return: mrr, perf_per_rel: mean reciprocal rank and performance per relation
'''
# 1) load configuration for grid search the best configuration
if n_hidden:
Expand Down
10 changes: 9 additions & 1 deletion examples/linkproppred/tkgl-polecat/cen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_cuda, model_name, mode, split_mode):
"""
Test the model
:param model: model used to test
:param history_list: all input history snap shot list, not include output label train list or valid list
:param test_list: test triple snap shot list
Expand Down Expand Up @@ -101,7 +102,14 @@ def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_c

def run_experiment(args, trainvalidtest_id=0, n_hidden=None, n_layers=None, dropout=None, n_bases=None):
'''
trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
Run experiment for CEN model
:param args: arguments for the model
:param trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
:param n_hidden: number of hidden units
:param n_layers: number of layers
:param dropout: dropout rate
:param n_bases: number of bases
return: mrr, perf_per_rel: mean reciprocal rank and performance per relation
'''
# 1) load configuration for grid search the best configuration
if n_hidden:
Expand Down
10 changes: 9 additions & 1 deletion examples/linkproppred/tkgl-smallpedia/cen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_cuda, model_name, mode, split_mode):
"""
Test the model
:param model: model used to test
:param history_list: all input history snap shot list, not include output label train list or valid list
:param test_list: test triple snap shot list
Expand Down Expand Up @@ -101,7 +102,14 @@ def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_c

def run_experiment(args, trainvalidtest_id=0, n_hidden=None, n_layers=None, dropout=None, n_bases=None):
'''
trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
Run experiment for CEN model
:param args: arguments for the model
:param trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
:param n_hidden: number of hidden units
:param n_layers: number of layers
:param dropout: dropout rate
:param n_bases: number of bases
return: mrr, perf_per_rel: mean reciprocal rank and performance per relation
'''
# 1) load configuration for grid search the best configuration
if n_hidden:
Expand Down
2 changes: 1 addition & 1 deletion examples/linkproppred/tkgl-smallpedia/edgebank.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def get_args():
Path(results_path).mkdir(parents=True, exist_ok=True)
results_filename = f'{results_path}/{MODEL_NAME}_{MEMORY_MODE}_{DATA}_results.json'

# ==================================================== Test
# ==================================================== Valid
# loading the validation negative samples
dataset.load_val_ns()

Expand Down
10 changes: 9 additions & 1 deletion examples/linkproppred/tkgl-yago/cen.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_cuda, model_name, mode, split_mode):
"""
Test the model
:param model: model used to test
:param history_list: all input history snap shot list, not include output label train list or valid list
:param test_list: test triple snap shot list
Expand Down Expand Up @@ -101,7 +102,14 @@ def test(model, history_len, history_list, test_list, num_rels, num_nodes, use_c

def run_experiment(args, trainvalidtest_id=0, n_hidden=None, n_layers=None, dropout=None, n_bases=None):
'''
trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
Run experiment for CEN model
:param args: arguments for the model
:param trainvalidtest_id: -1: pretrainig, 0: curriculum training (to find best test history len), 1: test on valid set, 2: test on test set
:param n_hidden: number of hidden units
:param n_layers: number of layers
:param dropout: dropout rate
:param n_bases: number of bases
return: mrr, perf_per_rel: mean reciprocal rank and performance per relation
'''
# 1) load configuration for grid search the best configuration
if n_hidden:
Expand Down

0 comments on commit 9a5cf5e

Please sign in to comment.