@@ 28-47 (lines=20) @@ | ||
25 | search_data.equals(search_data_) |
|
26 | ||
27 | ||
28 | def test_data_collector_1(): |
|
29 | def objective_function(opt): |
|
30 | score = -opt["x1"] * opt["x1"] |
|
31 | return score |
|
32 | ||
33 | search_space = { |
|
34 | "x1": np.arange(-100, 101, 1), |
|
35 | } |
|
36 | ||
37 | hyper = Hyperactive() |
|
38 | hyper.add_search(objective_function, search_space, n_iter=20) |
|
39 | hyper.run() |
|
40 | ||
41 | search_data = hyper.results(objective_function) |
|
42 | ||
43 | data_c = DataCollector("./search_data.csv") |
|
44 | data_c.save(search_data, replace_existing=True) |
|
45 | search_data_ = data_c.load() |
|
46 | ||
47 | search_data.equals(search_data_) |
|
48 | ||
49 | ||
50 | def test_data_collector_2(): |
|
@@ 6-25 (lines=20) @@ | ||
3 | from hyperactive.data_tools import DataCollector |
|
4 | ||
5 | ||
6 | def test_data_collector_0(): |
|
7 | def objective_function(opt): |
|
8 | score = -opt["x1"] * opt["x1"] |
|
9 | return score |
|
10 | ||
11 | search_space = { |
|
12 | "x1": np.arange(-100, 101, 1), |
|
13 | } |
|
14 | ||
15 | hyper = Hyperactive() |
|
16 | hyper.add_search(objective_function, search_space, n_iter=20) |
|
17 | hyper.run() |
|
18 | ||
19 | search_data = hyper.results(objective_function) |
|
20 | ||
21 | data_c = DataCollector("./search_data.csv") |
|
22 | data_c.save(search_data) |
|
23 | search_data_ = data_c.load() |
|
24 | ||
25 | search_data.equals(search_data_) |
|
26 | ||
27 | ||
28 | def test_data_collector_1(): |