-
Notifications
You must be signed in to change notification settings - Fork 81
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
d5312d6
commit 063666e
Showing
2 changed files
with
59 additions
and
5 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,50 @@ | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
import sys | ||
import numpy as np | ||
from litebo.utils.start_smbo import create_smbo | ||
|
||
|
||
def branin(x): | ||
xs = x.get_dictionary() | ||
x1 = xs['x1'] | ||
x2 = xs['x2'] | ||
a = 1. | ||
b = 5.1 / (4. * np.pi ** 2) | ||
c = 5. / np.pi | ||
r = 6. | ||
s = 10. | ||
t = 1. / (8. * np.pi) | ||
ret = a * (x2 - b * x1 ** 2 + c * x1 - r) ** 2 + s * (1 - t) * np.cos(x1) + s | ||
return {'objs': (ret,)} | ||
|
||
|
||
config_dict = { | ||
"optimizer": "SMBO", | ||
"parameters": { | ||
"x1": { | ||
"type": "float", | ||
"bound": [-5, 10], | ||
"default": 0 | ||
}, | ||
"x2": { | ||
"type": "float", | ||
"bound": [0, 15] | ||
}, | ||
}, | ||
"advisor_type": 'default', | ||
"max_runs": 50, | ||
"surrogate_type": 'gp', | ||
"time_limit_per_trial": 5, | ||
"logging_dir": 'logs', | ||
"task_id": 'hp1' | ||
} | ||
|
||
|
||
def main(): | ||
bo = create_smbo(branin, **config_dict) | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
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