| @@ 89-105 (lines=17) @@ | ||
| 86 | assert abs(hyper.best_score(objective_function)) < 0.001 |
|
| 87 | ||
| 88 | ||
| 89 | def test_initialize_grid_1(): |
|
| 90 | search_space = { |
|
| 91 | "x1": list(np.arange(-2, 3, 1)), |
|
| 92 | } |
|
| 93 | ||
| 94 | initialize = {"grid": 1} |
|
| 95 | ||
| 96 | hyper = Hyperactive() |
|
| 97 | hyper.add_search( |
|
| 98 | objective_function, |
|
| 99 | search_space, |
|
| 100 | n_iter=1, |
|
| 101 | initialize=initialize, |
|
| 102 | ) |
|
| 103 | hyper.run() |
|
| 104 | ||
| 105 | assert abs(hyper.best_score(objective_function)) - 1 < 0.001 |
|
| 106 | ||
| 107 | ||
| 108 | def test_initialize_all_0(): |
|
| @@ 71-86 (lines=16) @@ | ||
| 68 | assert abs(hyper.best_score(objective_function)) - 10000 < 0.001 |
|
| 69 | ||
| 70 | ||
| 71 | def test_initialize_grid_0(): |
|
| 72 | search_space = { |
|
| 73 | "x1": list(np.arange(-1, 2, 1)), |
|
| 74 | } |
|
| 75 | initialize = {"grid": 1} |
|
| 76 | ||
| 77 | hyper = Hyperactive() |
|
| 78 | hyper.add_search( |
|
| 79 | objective_function, |
|
| 80 | search_space, |
|
| 81 | n_iter=1, |
|
| 82 | initialize=initialize, |
|
| 83 | ) |
|
| 84 | hyper.run() |
|
| 85 | ||
| 86 | assert abs(hyper.best_score(objective_function)) < 0.001 |
|
| 87 | ||
| 88 | ||
| 89 | def test_initialize_grid_1(): |
|