@@ 83-101 (lines=19) @@ | ||
80 | assert len(set(x1_results)) < len(x1_results) |
|
81 | ||
82 | ||
83 | def test_attributes_results_7(): |
|
84 | def objective_function(para): |
|
85 | score = -para["x1"] * para["x1"] |
|
86 | return score |
|
87 | ||
88 | search_space = { |
|
89 | "x1": np.arange(0, 10, 1), |
|
90 | } |
|
91 | ||
92 | opt = RandomSearchOptimizer(search_space) |
|
93 | opt.search( |
|
94 | objective_function, n_iter=20, initialize={"random": 1}, memory=True |
|
95 | ) |
|
96 | ||
97 | x1_results = list(opt.results["x1"].values) |
|
98 | ||
99 | print("\n x1_results \n", x1_results) |
|
100 | ||
101 | assert len(set(x1_results)) == len(x1_results) |
|
102 | ||
103 | ||
104 | def test_attributes_results_8(): |
|
@@ 62-80 (lines=19) @@ | ||
59 | assert 10 in list(opt.results["x1"].values) |
|
60 | ||
61 | ||
62 | def test_attributes_results_6(): |
|
63 | def objective_function(para): |
|
64 | score = -para["x1"] * para["x1"] |
|
65 | return score |
|
66 | ||
67 | search_space = { |
|
68 | "x1": np.arange(0, 10, 1), |
|
69 | } |
|
70 | ||
71 | opt = RandomSearchOptimizer(search_space) |
|
72 | opt.search( |
|
73 | objective_function, n_iter=20, initialize={"random": 1}, memory=False |
|
74 | ) |
|
75 | ||
76 | x1_results = list(opt.results["x1"].values) |
|
77 | ||
78 | print("\n x1_results \n", x1_results) |
|
79 | ||
80 | assert len(set(x1_results)) < len(x1_results) |
|
81 | ||
82 | ||
83 | def test_attributes_results_7(): |