@@ 145-169 (lines=25) @@ | ||
142 | assert abs(best_score0 - best_score1) < err |
|
143 | ||
144 | ||
145 | def test_random_state_2(): |
|
146 | hyper0 = Hyperactive() |
|
147 | hyper0.add_search( |
|
148 | objective_function, |
|
149 | search_space, |
|
150 | n_iter=10, |
|
151 | initialize={"random": 1}, |
|
152 | random_state=1, |
|
153 | ) |
|
154 | hyper0.run() |
|
155 | ||
156 | hyper1 = Hyperactive() |
|
157 | hyper1.add_search( |
|
158 | objective_function, |
|
159 | search_space, |
|
160 | n_iter=10, |
|
161 | initialize={"random": 1}, |
|
162 | random_state=10, |
|
163 | ) |
|
164 | hyper1.run() |
|
165 | ||
166 | best_score0 = hyper0.best_score(objective_function) |
|
167 | best_score1 = hyper1.best_score(objective_function) |
|
168 | ||
169 | assert abs(best_score0 - best_score1) > err |
|
170 | ||
171 | ||
172 | def test_no_random_state_0(): |
|
@@ 118-142 (lines=25) @@ | ||
115 | assert abs(best_score0 - best_score1) < err |
|
116 | ||
117 | ||
118 | def test_random_state_1(): |
|
119 | hyper0 = Hyperactive() |
|
120 | hyper0.add_search( |
|
121 | objective_function, |
|
122 | search_space, |
|
123 | n_iter=10, |
|
124 | initialize={"random": 1}, |
|
125 | random_state=10, |
|
126 | ) |
|
127 | hyper0.run() |
|
128 | ||
129 | hyper1 = Hyperactive() |
|
130 | hyper1.add_search( |
|
131 | objective_function, |
|
132 | search_space, |
|
133 | n_iter=10, |
|
134 | initialize={"random": 1}, |
|
135 | random_state=10, |
|
136 | ) |
|
137 | hyper1.run() |
|
138 | ||
139 | best_score0 = hyper0.best_score(objective_function) |
|
140 | best_score1 = hyper1.best_score(objective_function) |
|
141 | ||
142 | assert abs(best_score0 - best_score1) < err |
|
143 | ||
144 | ||
145 | def test_random_state_2(): |
|
@@ 91-115 (lines=25) @@ | ||
88 | assert int(len(results) / n_jobs) != len(no_dup) |
|
89 | ||
90 | ||
91 | def test_random_state_0(): |
|
92 | hyper0 = Hyperactive() |
|
93 | hyper0.add_search( |
|
94 | objective_function, |
|
95 | search_space, |
|
96 | n_iter=10, |
|
97 | initialize={"random": 1}, |
|
98 | random_state=1, |
|
99 | ) |
|
100 | hyper0.run() |
|
101 | ||
102 | hyper1 = Hyperactive() |
|
103 | hyper1.add_search( |
|
104 | objective_function, |
|
105 | search_space, |
|
106 | n_iter=10, |
|
107 | initialize={"random": 1}, |
|
108 | random_state=1, |
|
109 | ) |
|
110 | hyper1.run() |
|
111 | ||
112 | best_score0 = hyper0.best_score(objective_function) |
|
113 | best_score1 = hyper1.best_score(objective_function) |
|
114 | ||
115 | assert abs(best_score0 - best_score1) < err |
|
116 | ||
117 | ||
118 | def test_random_state_1(): |