-
Notifications
You must be signed in to change notification settings - Fork 239
Feat (benchmark): Allow easy specification of different search algorithms within benchmark scripts #1357
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
base: dev
Are you sure you want to change the base?
Conversation
…n be "plugged into" a benchmark configuration
…SearchBenchmarkUtils`
…ive rounding algorithms are enabled
nickfraser
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch to Mixin.
| pass | ||
|
|
||
|
|
||
| class BenchmarkSearchMixin(ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indicate that the concrete classes need to provide the abstract class variable argument_parser, e.g.
@property
@abstractmethod
def argument_parser(self) -> ArgumentParser:
pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not 100% sure about this... It's already specified in class BenchmarkUtils(ABC):. You want it in class BenchmarkSearchMixin(ABC): as well? Or instead of or as well as BenchmarkUtils?
| return id_str | ||
|
|
||
|
|
||
| class RandomSearchMixin(BenchmarkSearchMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a subset of the functionality of standardize_args which is shared for GridSearchMixin and RandomSearchMixing, e.g. YAML reading. Is it possible to extract the common functionality to the abstract parent class.
| return args_dict | ||
|
|
||
| @staticmethod | ||
| def parse_config_args(args: List[str]) -> Namespace: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the arguments are shared between GridSearchMixin and RandomSearchMixin, I would consider extracting the common logic.
| q = q[start_index:end_index] | ||
| args_dict = entrypoint_utils.standardize_args(script_args) | ||
| # Generate a list of experiments | ||
| q = entrypoint_utils.gen_search_space(args_dict, script_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it is worth renaming q to something more self-explanatory.
Builds on #1356. Introduces a
BenchmarkSearchMixinwhich determines how we generate experiments with the benchmark utils. The first oneGridSearchMixin, replicates the behaviour of the benchmark utils before this PR was made.The second one is a
RandomSearchMixin, which allow specification of various search algorithms that can be used to specify parameters, for example:Running as follows:
Will give the following output:
Note, a limitation with the current approach is that the worker queue generation (i.e., the random search space) and execution (i.e., the experiments) are two separate steps, meaning that it's difficult to integrate experiment feedback into the search space selection (e.g., for Bayesian optimization or simulated annealing).