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

refactor: Simplify Prior, Sampler and ConfigEncoder construction #182

Merged
merged 2 commits into from
Jan 26, 2025

Conversation

eddiebergman
Copy link
Contributor

The issue stemmed from the fact the SearchSpace was putting fidelities in the .numerical attribute of the SearchSpace, as well as the .prior attribute, which didn't really make sense, and caused later use of space.prior to not have the kind of information needed.

The solution was not to just patch this one issue, but rather remove a lot of the convenience of the SearchSpace with the .prior, and the .from_space(..., include_fidelities: bool = ...) methods, as their behaviour wasn't obvious from construction. Rather now, the .from_space() methods have been replaced with .from_parameters(...), where if you'd like to include a fidelitiy in that set of things to operate on, then you can construct it explicitly at the call site and pass it in, rather than .from_space(space, include_fidelity=False).

This also allowed us to actually remove a bunch of code and reduce if pathways, hopeully reducing the chance of further bugs.

... and yes tests.

This also revealed an issue I fixed in #181, so I pulled those changes to SuccessiveHalving brackets into here.

The issue stemmed from the fact the `SearchSpace` was putting
fidelities in the `.numerical` attribute of the `SearchSpace`, as
well as the `.prior` attribute, which didn't really make sense, and
caused later use of `space.prior` to not have the kind of information
needed.

The solution was not to just patch this one issue, but rather remove
a lot of the _convenience_ of the `SearchSpace` with the `.prior`, and
the `.from_space(..., include_fidelities: bool = ...)` methods, as their
behaviour wasn't obvious from construction. Rather now, the
`.from_space()` methods have been replaced with `.from_parameters(...)`,
where if you'd like to include a fidelitiy in that set of things to
operate on, then you can construct it explicitly at the call site and
pass it in, rather than `.from_space(space, include_fidelity=False)`.

This also allowed us to actually remove a bunch of code and reduce `if`
pathways, hopeully reducing the chance of further bugs.

... and yes tests.
@eddiebergman eddiebergman mentioned this pull request Jan 26, 2025
@eddiebergman
Copy link
Contributor Author

Merging, two failed tests are windows, see raised issue #183

@eddiebergman eddiebergman merged commit da840b1 into master Jan 26, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant