Random local search over a set of permissible values#374
Open
HenrikMettler wants to merge 1 commit intomasterfrom
Open
Random local search over a set of permissible values#374HenrikMettler wants to merge 1 commit intomasterfrom
HenrikMettler wants to merge 1 commit intomasterfrom
Conversation
2f6ee3b to
7865a93
Compare
Contributor
Author
|
(CI-check fail seems like an unrelated mypy issue) |
jakobj
requested changes
Dec 6, 2022
Member
jakobj
left a comment
There was a problem hiding this comment.
great stuff, thanks for working on this! 🚀
I left a few comments, please address them before we merge this
| objective: Callable, | ||
| seed: int, | ||
| n_steps: int = 10, # todo: should this be dependent on the number of parameters? | ||
| permissible_values: np.ndarray = np.logspace(start=0, stop=7, num=8, base=2, dtype=int), |
Member
There was a problem hiding this comment.
in the current implementation, is it, for example, possible to say "parameters should be uniformly sampled in the interval [0, 1]"? if not, I think it would be a good idea to make the generation of permissible values modular to support such use cases
| params=params_sampled, params_names=params_names | ||
| ) | ||
| # evaluate fitness | ||
| self.objective(new_ind) |
Member
There was a problem hiding this comment.
as discussed, the local-search objective should not modify individuals but return a fitness value
| ind.fitness = new_ind.fitness | ||
|
|
||
|
|
||
| if __name__ == "__main__": |
Member
There was a problem hiding this comment.
the rest should be moved into a test I guess ;)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #373. This is based on an implementation I used in a project with hal-cgp, thus the default values for
permissible-values. There is two open questions, marked as todo in the code comments.For convenience i put a short example at the end. I can extend this to a full example before merging or remove it.