| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import pytest |
||
| 2 | |||
| 3 | from hyperactive import Hyperactive |
||
| 4 | |||
| 5 | from ._search_space_list import search_space_setup |
||
| 6 | |||
| 7 | search_space_list = search_space_setup() |
||
| 8 | |||
| 9 | |||
| 10 | def objective_function(opt): |
||
| 11 | score = -opt["x1"] * opt["x1"] |
||
| 12 | return score |
||
| 13 | |||
| 14 | |||
| 15 | @pytest.mark.parametrize("search_space", search_space_list) |
||
| 16 | def test_warm_start_0(search_space): |
||
| 17 | hyper0 = Hyperactive() |
||
| 18 | hyper0.add_search(objective_function, search_space, n_iter=20) |
||
| 19 | hyper0.run() |
||
| 20 | |||
| 21 | search_data0 = hyper0.best_para(objective_function) |
||
| 22 | |||
| 23 | hyper1 = Hyperactive() |
||
| 24 | hyper1.add_search( |
||
| 25 | objective_function, |
||
| 26 | search_space, |
||
| 27 | n_iter=20, |
||
| 28 | initialize={"warm_start": [search_data0]}, |
||
| 29 | ) |
||
| 30 | hyper1.run() |
||
| 31 |