Skip to content

Commit

Permalink
Merge pull request #119 from MaxFBurg/master
Browse files Browse the repository at this point in the history
Bugfix: property not callable
  • Loading branch information
KonstantinWilleke authored Mar 22, 2021
2 parents 567507a + b29c7d9 commit 3d6b629
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions nnfabrik/utility/hypersearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _split_config(params):

def train_evaluate(self, auto_params):
"""
For a given set of parameters, add an entry to the corresponding tables, and populated the trained model
For a given set of parameters, add an entry to the corresponding tables, and populate the trained model
table for that specific entry.
Args:
Expand All @@ -174,23 +174,23 @@ def train_evaluate(self, auto_params):
dataset_hash = make_hash(config["dataset"])
entry_exists = {
"dataset_fn": "{}".format(self.fns["dataset"])
} in self.trained_model_table.dataset_table() and {
} in self.trained_model_table().dataset_table() and {
"dataset_hash": "{}".format(dataset_hash)
} in self.trained_model_table.dataset_table()
} in self.trained_model_table().dataset_table()
if not entry_exists:
self.trained_model_table.dataset_table().add_entry(
self.trained_model_table().dataset_table().add_entry(
self.fns["dataset"],
config["dataset"],
dataset_fabrikant=self.architect,
dataset_comment=self.comment,
)

model_hash = make_hash(config["model"])
entry_exists = {"model_fn": "{}".format(self.fns["model"])} in self.trained_model_table.model_table() and {
entry_exists = {"model_fn": "{}".format(self.fns["model"])} in self.trained_model_table().model_table() and {
"model_hash": "{}".format(model_hash)
} in self.trained_model_table.model_table()
} in self.trained_model_table().model_table()
if not entry_exists:
self.trained_model_table.model_table().add_entry(
self.trained_model_table().model_table().add_entry(
self.fns["model"],
config["model"],
model_fabrikant=self.architect,
Expand All @@ -200,11 +200,11 @@ def train_evaluate(self, auto_params):
trainer_hash = make_hash(config["trainer"])
entry_exists = {
"trainer_fn": "{}".format(self.fns["trainer"])
} in self.trained_model_table.trainer_table() and {
} in self.trained_model_table().trainer_table() and {
"trainer_hash": "{}".format(trainer_hash)
} in self.trained_model_table.trainer_table()
} in self.trained_model_table().trainer_table()
if not entry_exists:
self.trained_model_table.trainer_table().add_entry(
self.trained_model_table().trainer_table().add_entry(
self.fns["trainer"],
config["trainer"],
trainer_fabrikant=self.architect,
Expand Down Expand Up @@ -406,23 +406,23 @@ def train_evaluate(self, auto_params):
dataset_hash = make_hash(config["dataset"])
entry_exists = {
"dataset_fn": "{}".format(self.fns["dataset"])
} in self.trained_model_table.dataset_table() and {
} in self.trained_model_table().dataset_table() and {
"dataset_hash": "{}".format(dataset_hash)
} in self.trained_model_table.dataset_table()
} in self.trained_model_table().dataset_table()
if not entry_exists:
self.trained_model_table.dataset_table().add_entry(
self.trained_model_table().dataset_table().add_entry(
self.fns["dataset"],
config["dataset"],
dataset_fabrikant=self.architect,
dataset_comment=self.comment,
)

model_hash = make_hash(config["model"])
entry_exists = {"model_fn": "{}".format(self.fns["model"])} in self.trained_model_table.model_table() and {
entry_exists = {"model_fn": "{}".format(self.fns["model"])} in self.trained_model_table().model_table() and {
"model_hash": "{}".format(model_hash)
} in self.trained_model_table.model_table()
} in self.trained_model_table().model_table()
if not entry_exists:
self.trained_model_table.model_table().add_entry(
self.trained_model_table().model_table().add_entry(
self.fns["model"],
config["model"],
model_fabrikant=self.architect,
Expand All @@ -432,11 +432,11 @@ def train_evaluate(self, auto_params):
trainer_hash = make_hash(config["trainer"])
entry_exists = {
"trainer_fn": "{}".format(self.fns["trainer"])
} in self.trained_model_table.trainer_table() and {
} in self.trained_model_table().trainer_table() and {
"trainer_hash": "{}".format(trainer_hash)
} in self.trained_model_table.trainer_table()
} in self.trained_model_table().trainer_table()
if not entry_exists:
self.trained_model_table.trainer_table().add_entry(
self.trained_model_table().trainer_table().add_entry(
self.fns["trainer"],
config["trainer"],
trainer_fabrikant=self.architect,
Expand Down Expand Up @@ -479,7 +479,7 @@ def run(self):
"""
Runs the random hyperparameter search, for as many trials as specified.
"""
n_trials = len(self.trained_model_table.seed_table()) * self.total_trials
n_trials = len(self.trained_model_table().seed_table()) * self.total_trials
init_len = len(self.trained_model_table())
while len(self.trained_model_table()) - init_len < n_trials:
self.train_evaluate(self.gen_params_value())

0 comments on commit 3d6b629

Please sign in to comment.