|
@@ 56-69 (lines=14) @@
|
| 53 |
|
assert "_x1_" in list(opt.search_data.columns) |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
def test_obj_func_return_dictionary_1(): |
| 57 |
|
def objective_function(para): |
| 58 |
|
score = -para["x1"] * para["x1"] |
| 59 |
|
return score, {"_x1_": para["x1"], "_x1_*2": para["x1"] * 2} |
| 60 |
|
|
| 61 |
|
search_space = { |
| 62 |
|
"x1": np.arange(-100, 101, 1), |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
opt = RandomSearchOptimizer(search_space) |
| 66 |
|
opt.search(objective_function, n_iter=30) |
| 67 |
|
|
| 68 |
|
assert "_x1_" in list(opt.search_data.columns) |
| 69 |
|
assert "_x1_*2" in list(opt.search_data.columns) |
| 70 |
|
|
|
@@ 41-53 (lines=13) @@
|
| 38 |
|
opt.search(model, n_iter=30) |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
def test_obj_func_return_dictionary_0(): |
| 42 |
|
def objective_function(para): |
| 43 |
|
score = -para["x1"] * para["x1"] |
| 44 |
|
return score, {"_x1_": para["x1"]} |
| 45 |
|
|
| 46 |
|
search_space = { |
| 47 |
|
"x1": np.arange(-100, 101, 1), |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
opt = RandomSearchOptimizer(search_space) |
| 51 |
|
opt.search(objective_function, n_iter=30) |
| 52 |
|
|
| 53 |
|
assert "_x1_" in list(opt.search_data.columns) |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
def test_obj_func_return_dictionary_1(): |