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

[SearchSpace] Allow None/ bool as a valid value in Categorical/Constant #124

Open
eddiebergman opened this issue Jul 31, 2024 · 0 comments
Milestone

Comments

@eddiebergman
Copy link
Contributor

eddiebergman commented Jul 31, 2024

Right now, the only accepted values are Iterable[float | int | str] and the default is the same, i.e. float | int | str | None = None.

There's no real restriction for this other than it needs to be tracked down where things like the following might happen, if default... (which would also not work for 0 fyi), and replace them with if default is not NotSet where NotSet follows then Sentinal pattern (it's just NotSet = object() and you check if it was not set by doing if default is NotSet)

For example, one thing that would need to change is the following:

if hp.default is None:
if not ignore_missing_defaults:
raise ValueError(f"No defaults specified for {hp} in the space.")

EDIT: apparently I already did some of this a while back but didn't complete it nor test it...

for hp_key, current_hp in self.hyperparameters.items():
new_hp_value = hyperparameters.get(hp_key, NotSet)
if isinstance(new_hp_value, _NotSet):
continue

@eddiebergman eddiebergman added this to the Search Space milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant