-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
12 changed files
with
213 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
defaults: | ||
- _self_ | ||
- override hydra/sweeper: HyperHEBO | ||
|
||
|
||
learning_rate: constant | ||
learning_rate_init: 0.001 | ||
batch_size: 200 | ||
n_neurons: 10 | ||
n_layer: 1 | ||
solver: adam | ||
activation: tanh | ||
|
||
seed: 42 | ||
epochs: 10 # Default number of epochs | ||
|
||
hydra: | ||
sweeper: | ||
budget: 10 | ||
optimizer_kwargs: | ||
checkpoint_tf: true | ||
load_tf: true | ||
search_space: | ||
hyperparameters: | ||
n_layer: | ||
type: uniform_int | ||
lower: 1 | ||
upper: 5 | ||
default: ${n_layer} | ||
n_neurons: | ||
type: uniform_int | ||
lower: 8 | ||
upper: 1024 | ||
log: true | ||
default_value: ${n_neurons} | ||
activation: | ||
type: categorical | ||
choices: [ logistic, tanh, relu ] | ||
default_value: ${activation} | ||
solver: | ||
type: categorical | ||
choices: [ lbfgs, sgd, adam ] | ||
default_value: ${solver} | ||
batch_size: | ||
type: uniform_int | ||
lower: 30 | ||
upper: 300 | ||
default_value: ${batch_size} | ||
learning_rate: | ||
type: categorical | ||
choices: [ constant, invscaling, adaptive ] | ||
default_value: ${learning_rate} | ||
learning_rate_init: | ||
type: uniform_float | ||
lower: 0.0001 | ||
upper: 1 | ||
default_value: ${learning_rate_init} | ||
log: true | ||
|
||
run: | ||
dir: ./tmp/${now:%Y-%m-%d}/${now:%H-%M-%S} | ||
sweep: | ||
dir: ./tmp/${now:%Y-%m-%d}/${now:%H-%M-%S} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .config import HyperCARPSConfig | ||
|
||
__all__ = ["HyperCARPSConfig"] | ||
__all__ = ["HyperCARPSConfig"] |
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 |
---|---|---|
@@ -1,20 +1,33 @@ | ||
"""CARP-S optimizer adapter for HyperSweeper.""" | ||
|
||
from __future__ import annotations | ||
|
||
from carps.benchmarks.dummy_problem import DummyProblem | ||
|
||
from hydra_plugins.hypersweeper import Info | ||
|
||
|
||
class HyperCARPSAdapter: | ||
"""CARP-S optimizer.""" | ||
|
||
def __init__(self, carps) -> None: | ||
"""Initialize the optimizer.""" | ||
self.carps = carps | ||
|
||
def ask(self): | ||
"""Ask for the next configuration.""" | ||
carps_info = self.carps.ask() | ||
info = Info(carps_info.config, carps_info.budget, None, carps_info.seed) | ||
return info, False | ||
|
||
def tell(self, info, value): | ||
"""Tell the result of the configuration.""" | ||
self.smac.tell(info, value) | ||
|
||
|
||
def make_carp_s(configspace, carps_args): | ||
"""Make a CARP-S instance for optimization.""" | ||
problem = DummyProblem() | ||
problem._configspace = configspace | ||
optimizer = carps_args["optimizer"](problem) | ||
return HyperCARPSAdapter(optimizer) | ||
return HyperCARPSAdapter(optimizer) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .config import HyperHEBOConfig | ||
|
||
__all__ = ["HyperHEBOConfig"] | ||
__all__ = ["HyperHEBOConfig"] |
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
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,3 @@ | ||
from .config import HyperRSConfig | ||
|
||
__all__ = ["HyperRSConfig"] |
Oops, something went wrong.