Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add seed option to SMAC #193

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package/samplers/smac_sampler/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def __init__(
self,
search_space: dict[str, BaseDistribution],
n_trials: int = 100,
seed: int = -1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if seed is set as -1, SMAC will generate a random seed and we cannot guarantee the reproducibility. This argument here is not so intuitive to users, so it would be best if we can also mark this in the docs (such that users will change this to another value if they require reproducibility)

*,
surrogate_model_type: str = "rf",
acq_func_type: str = "ei_log",
Expand All @@ -113,7 +114,7 @@ def __init__(
) -> None:
super().__init__(search_space)
self._cs, self._hp_scale_value = self._convert_to_config_space_design_space(search_space)
scenario = Scenario(configspace=self._cs, deterministic=True, n_trials=n_trials)
scenario = Scenario(configspace=self._cs, deterministic=True, n_trials=n_trials, seed=seed)
surrogate_model = self._get_surrogate_model(
scenario,
surrogate_model_type,
Expand Down