-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0989087
commit 35219c7
Showing
17 changed files
with
559 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
## Optimizer Configuration Options | ||
|
||
Before running the optimizer for your AutoML tasks, you have several configuration options to tailor the optimization process to your specific needs. These options allow you to customize the optimizer's behavior according to your preferences and requirements. | ||
|
||
### 1. Automatic Optimizer Selection | ||
|
||
If you prefer not to specify a particular optimizer for your AutoML task, you can simply pass `default` or `None` for the neps searcher. NePS will automatically choose the best optimizer based on the characteristics of your search space. This provides a hassle-free way to get started quickly. | ||
|
||
The optimizer selection is based on the following characteristics of your search space: | ||
|
||
- If it has fidelity: hyperband | ||
- If it has a prior: pibo | ||
- If it has both fidelity and a prior: priorband | ||
- If it has neither: bayesian_optimization | ||
|
||
### 2. Choosing one of NePS Optimizers | ||
|
||
We have also prepared some optimizers with specific hyperparameters that we believe can generalize well to most AutoML tasks and use cases. For more details on the available default optimizers and the algorithms that can be called, please refer to the next section on SearcherConfigs. | ||
|
||
### 3. Custom Optimizer Configuration via YAML | ||
|
||
For users who want more control over the optimizer's hyperparameters, you can create your own YAML configuration file. In this file, you can specify the hyperparameters for your preferred optimizer. To use this custom configuration, provide the path to your YAML file using the `searcher_path` parameter when running the optimizer. The library will then load your custom settings and use them for optimization. | ||
|
||
Here's the format of the YAML configuration using `Bayesian Optimization` as an example: | ||
|
||
```yaml | ||
searcher_init: | ||
algorithm: bayesian_optimization | ||
searcher_kwargs: # Specific arguments depending on the searcher | ||
initial_design_size: 5 | ||
surrogate_model: gp_hierarchy # or {"gp_hierarchy", "deep_gp"} | ||
acquisition: EI # or {"LogEI", "AEI", "MFEI"} | ||
log_prior_weighted: false | ||
acquisition_sampler: random # or {"mutation", "evolution", "freeze-thaw"} | ||
random_interleave_prob: 0.0 | ||
disable_priors: false | ||
prior_confidence: high | ||
sample_default_first: true | ||
``` | ||
### 4. Hyperparameter Overrides | ||
If you want to make on-the-fly adjustments to the optimizer's hyperparameters without modifying the YAML configuration file, you can do so by passing keyword arguments (kwargs) to the neps.run function itself. This enables you to fine-tune specific hyperparameters without the need for YAML file updates. Any hyperparameter values provided as kwargs will take precedence over those specified in the YAML configuration. | ||
### Note for Contributors | ||
When designing a new optimizer, it's essential to create a YAML configuration file in the `default_searcher` folder under `neps.src.optimizers`. This YAML file should contain the default configuration settings that you believe should be used when the user chooses the searcher. | ||
|
||
Even when many hyperparameters might be set to their default values as specified in the code, it is still considered good practice to include them in the YAML file. This is because the `SearcherConfigs` method relies on the arguments from the YAML file to display the optimizer's configuration to the user. | ||
|
||
## Searcher Configurations | ||
|
||
The `SearcherConfigs` class provides a set of useful functions to manage and retrieve default configuration details for NePS optimizers. These functions can help you understand and interact with the available searchers and their associated algorithms and configurations. | ||
|
||
### Importing `SearcherConfigs` | ||
|
||
Before you can use the `SearcherConfigs` class to manage and retrieve default configuration details for NePS optimizers, make sure to import it into your Python script. You can do this with the following import statement: | ||
|
||
```python | ||
from neps.optimizers.info import SearcherConfigs | ||
``` | ||
|
||
Once you have imported the class, you can proceed to use its functions to explore the available searchers, algorithms, and configuration details. | ||
|
||
### List Available Searchers | ||
|
||
To list all the available searchers that can be used in NePS runs, you can use the `get_searchers` function. It provides you with a list of searcher names: | ||
|
||
```python | ||
searchers = SearcherConfigs.get_searchers() | ||
print("Available searchers:", searchers) | ||
``` | ||
|
||
### List Available Searching Algorithms | ||
|
||
The `get_available_algorithms` function helps you discover the searching algorithms available within the NePS searchers: | ||
|
||
```python | ||
algorithms = SearcherConfigs.get_available_algorithms() | ||
print("Available searching algorithms:", algorithms) | ||
``` | ||
|
||
### Find Searchers Using a Specific Algorithm | ||
|
||
If you want to identify which NePS searchers are using a specific searching algorithm (e.g., Bayesian Optimization, Hyperband, PriorBand...), you can use the `get_searcher_from_alg` function. It returns a list of searchers utilizing the specified algorithm: | ||
|
||
```python | ||
algorithm = "bayesian_optimization" # Replace with the desired algorithm | ||
searchers = SearcherConfigs.get_searcher_from_alg(algorithm) | ||
print(f"Searchers using {algorithm}:", searchers) | ||
``` | ||
|
||
### Retrieve Searcher Configuration Details | ||
|
||
To access the configuration details of a specific searcher, you can use the `get_searcher_kwargs` function. Provide the name of the searcher you are interested in, and it will return the searcher's configuration: | ||
|
||
```python | ||
searcher_name = "pibo" # Replace with the desired NePS searcher name | ||
searcher_kwargs = SearcherConfigs.get_searcher_kwargs(searcher_name) | ||
print(f"Configuration of {searcher_name}:", searcher_kwargs) | ||
``` | ||
|
||
These functions empower you to explore and manage the available NePS searchers and their configurations effectively. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
searcher_init: | ||
algorithm: asha | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
eta: 3 | ||
early_stopping_rate: 0 | ||
initial_design_type: max_budget # or {"unique_configs"} | ||
use_priors: false | ||
random_interleave_prob: 0.0 | ||
sample_default_first: false | ||
sample_default_at_target: false | ||
|
||
# Arguments that can not be modified by the user | ||
# sampling_policy: RandomUniformPolicy | ||
# promotion_policy: AsyncPromotionPolicy | ||
|
||
# Other arguments | ||
# ignore_errors: false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
searcher_init: | ||
algorithm: asha_prior | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
eta: 3 | ||
early_stopping_rate: 0 | ||
initial_design_type: max_budget # or {"unique_configs"} | ||
prior_confidence: medium # or {"low", "high"} | ||
random_interleave_prob: 0.0 | ||
sample_default_first: true | ||
sample_default_at_target: false | ||
|
||
# Arguments that can not be modified by the user | ||
# sampling_policy: FixedPriorPolicy | ||
# promotion_policy: AsyncPromotionPolicy | ||
|
||
# Other arguments | ||
# ignore_errors: false |
19 changes: 19 additions & 0 deletions
19
src/neps/optimizers/default_searchers/bayesian_optimization.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
searcher_init: | ||
algorithm: bayesian_optimization | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
initial_design_size: 10 | ||
surrogate_model: gp # or {"gp_hierarchy", "deep_gp"} | ||
acquisition: EI # or {"LogEI", "AEI", "MFEI"} | ||
log_prior_weighted: false | ||
acquisition_sampler: mutation # or {"random", "evolution", "freeze-thaw"} | ||
random_interleave_prob: 0.0 | ||
disable_priors: true | ||
sample_default_first: false | ||
|
||
# Other arguments: | ||
# surrogate_model_args: None # type: dict | ||
# optimal_assignment: false # type: bool | ||
# domain_se_kernel: None # type: str | ||
# graph_kernels: None # type: list | ||
# hp_kernels: None # type: list |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
searcher_init: | ||
algorithm: hyperband | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
eta: 3 | ||
initial_design_type: max_budget # or {"unique_configs"} | ||
use_priors: false | ||
random_interleave_prob: 0.0 | ||
sample_default_first: false | ||
sample_default_at_target: false | ||
|
||
# Arguments that can not be modified by the user | ||
# sampling_policy: RandomUniformPolicy | ||
# promotion_policy: AsyncPromotionPolicy |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
searcher_init: | ||
algorithm: mf_ei_bo | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
step_size: 1 | ||
use_priors: false | ||
sample_default_first: false | ||
sample_default_at_target: false | ||
|
||
# Arguments for model | ||
surrogate_model: deep_gp # or {"gp", "gp_hierarchy"} | ||
acquisition: MFEI # or {"LogEI", "AEI", "EI"} | ||
acquisition_sampler: freeze-thaw # or {"random", "evolution", "mutation"} | ||
initial_design_fraction: 0.75 | ||
initial_design_size: 10 | ||
|
||
# Arguments that can not be modified by the user | ||
# model_policy: MFEIDeepModel | ||
|
||
# Other arguments | ||
# surrogate_model_args: None # type: dict | ||
# optimal_assignment: false # type: bool | ||
# domain_se_kernel: None # type: str | ||
# graph_kernels: None # type: list | ||
# hp_kernels: None # type: list | ||
# initial_design_budget: None # type: int |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
searcher_init: | ||
algorithm: mobster | ||
searcher_kwargs: | ||
# Arguments that can be modified by the user | ||
eta: 3 | ||
initial_design_type: max_budget # or {"unique_configs"} | ||
use_priors: false | ||
random_interleave_prob: 0.0 | ||
sample_default_first: false | ||
sample_default_at_target: false | ||
|
||
# arguments for model | ||
surrogate_model: gp # or {"gp_hierarchy", "deep_gp"} | ||
acquisition: EI # or {"LogEI", "AEI", "MFEI"} | ||
log_prior_weighted: false | ||
acquisition_sampler: mutation # or {"random", "evolution", "freeze-thaw"} | ||
|
||
# Arguments that can not be modified by the user | ||
# sampling_policy: RandomUniformPolicy | ||
# promotion_policy: AsyncPromotionPolicy | ||
# model_policy: ModelPolicy | ||
|
||
# Other arguments | ||
# surrogate_model_args: None # type: dict | ||
# domain_se_kernel: None # type: str | ||
# graph_kernels: None # type: list | ||
# hp_kernels: None # type: list |
Oops, something went wrong.