Skip to content

Commit

Permalink
fix namespace model generation hyperspace exploration
Browse files Browse the repository at this point in the history
advanced_configuration.yml like in Elliot paper
  • Loading branch information
scne committed Mar 10, 2021
1 parent e9733b3 commit 98ec4d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 0 additions & 4 deletions config_files/advanced_configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ experiment:
folds: 5
top_k: 50
evaluation:
cutoff: 10
simple_metrics: [nDCG, ACLT, APLT, ARP, PopREO]
complex_metrics:
- metric: UserMADrating
Expand Down Expand Up @@ -45,7 +44,6 @@ experiment:
meta:
hyper_max_evals: 5
hyper_opt_alg: tpe
validation_rate: 5
lr: [loguniform, -10, -1]
batch_size: [128, 256, 512]
epochs: 50
Expand All @@ -59,7 +57,6 @@ experiment:
meta:
hyper_max_evals: 5
hyper_opt_alg: tpe
validation_rate: 5
lr: [0.0005, 0.001, 0.005, 0.01]
epochs: 50
batch_size: [128, 256, 512]
Expand All @@ -71,7 +68,6 @@ experiment:
meta:
hyper_max_evals: 5
hyper_opt_alg: rand
validation_rate: 5
lr: [0.0005, 0.001, 0.005, 0.01]
batch_size: [128, 256, 512]
epochs: 50
Expand Down
15 changes: 9 additions & 6 deletions elliot/namespace/namespace_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,15 @@ def fill_model(self):
val = [v for v in val if v is not None]
space_list.append((k, func_(k, *val)))
else:
if all([isinstance(v, str) for v in value]):
space_list.append((k, hp.choice(k, value)))
else:
space_list.append((k, hp.choice(k, literal_eval(
"["+str(",".join([str(v) for v in value]))+"]")
)))
# if not all([isinstance(v, str) for v in value]):
# space_list.append((k, hp.choice(k, value)))
# else:
# space_list.append((k, hp.choice(k, literal_eval(
# "["+str(",".join([str(v) for v in value]))+"]")
# )))
space_list.append((k, hp.choice(k, literal_eval(
"[" + str(",".join([str(v) for v in value])) + "]")
)))
_SPACE = OrderedDict(space_list)
_estimated_evals = reduce(lambda x, y: x*y, [len(param.pos_args) - 1 for _, param in _SPACE.items()], 1)
_max_evals = meta_model.get(_hyper_max_evals, _estimated_evals)
Expand Down

0 comments on commit 98ec4d3

Please sign in to comment.