Skip to content

Commit

Permalink
merge should have worked now
Browse files Browse the repository at this point in the history
  • Loading branch information
KrissiHub committed Nov 23, 2023
1 parent 6e9e9bf commit 8ab95e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion deepcave/evaluators/epm/random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(
instance_features: Optional[np.ndarray] = None,
pca_components: Optional[int] = 2,
log_y: bool = False,
seed: int = 0,
seed: Optional[int] = 0,
):
self.cs = configspace
self.log_y = log_y
Expand Down
20 changes: 10 additions & 10 deletions tests/test_evaluators/test_fanova.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ def test(self):
objective = self.run.get_objective(0)

# Calculate
self.evaluator.calculate(objective, budget)
importance_dict_run_1 = self.evaluator.get_importances(self.hp_names)
self.evaluator.calculate(objective, budget, seed=0)
importances = self.evaluator.get_importances(self.hp_names)

self.evaluator.calculate(objective, budget)
importance_dict_run_2 = self.evaluator.get_importances(self.hp_names)
self.evaluator.calculate(objective, budget, seed=42)
importances2 = self.evaluator.get_importances(self.hp_names)

# No seed: Different results
assert importance_dict_run_1["n_neurons"][1] != importance_dict_run_2["n_neurons"][1]
# Different seed: Different results
assert importances["batch_size"][1] != importances2["batch_size"][1]

def test_seed(self):
budget = self.run.get_budget(0)
objective = self.run.get_objective(0)

# Calculate
self.evaluator.calculate(objective, budget, seed=0)
importance_dict_run_1 = self.evaluator.get_importances(self.hp_names)
importances = self.evaluator.get_importances(self.hp_names)

self.evaluator.calculate(objective, budget, seed=0)
importance_dict_run_2 = self.evaluator.get_importances(self.hp_names)
importances2 = self.evaluator.get_importances(self.hp_names)

# With seed: Same results
assert importance_dict_run_1["n_neurons"][1] == importance_dict_run_2["n_neurons"][1]
# Same seed: Same results
assert importances["batch_size"][1] == importances2["batch_size"][1]


if __name__ == "__main__":
Expand Down

0 comments on commit 8ab95e7

Please sign in to comment.