@@ 284-316 (lines=33) @@ | ||
281 | assert d_time_frac > 1.5 |
|
282 | ||
283 | ||
284 | @pytest.mark.parametrize("search_space", search_space_list) |
|
285 | def test_memory_warm_start_1(search_space): |
|
286 | n_iter = 1500 |
|
287 | ||
288 | c_time = time.perf_counter() |
|
289 | hyper0 = Hyperactive(distribution="pathos") |
|
290 | hyper0.add_search( |
|
291 | objective_function, search_space, n_iter=n_iter, n_jobs=2, memory=True |
|
292 | ) |
|
293 | hyper0.run() |
|
294 | d_time_1 = time.perf_counter() - c_time |
|
295 | ||
296 | search_data0 = hyper0.search_data(objective_function) |
|
297 | ||
298 | c_time = time.perf_counter() |
|
299 | hyper1 = Hyperactive(distribution="pathos") |
|
300 | hyper1.add_search( |
|
301 | objective_function, |
|
302 | search_space, |
|
303 | n_iter=n_iter, |
|
304 | n_jobs=2, |
|
305 | memory=True, |
|
306 | memory_warm_start=search_data0, |
|
307 | ) |
|
308 | hyper1.run() |
|
309 | d_time_2 = time.perf_counter() - c_time |
|
310 | ||
311 | d_time_frac = d_time_1 / d_time_2 |
|
312 | ||
313 | print("\n d_time_1 ", d_time_1) |
|
314 | print("\n d_time_2 ", d_time_2) |
|
315 | ||
316 | assert d_time_frac > 1.5 |
|
317 | ||
@@ 217-248 (lines=32) @@ | ||
214 | return 0 |
|
215 | ||
216 | ||
217 | @pytest.mark.parametrize("search_space", search_space_list) |
|
218 | def test_memory_warm_start_0(search_space): |
|
219 | n_iter = 1500 |
|
220 | ||
221 | c_time = time.perf_counter() |
|
222 | hyper0 = Hyperactive(distribution="pathos") |
|
223 | hyper0.add_search( |
|
224 | objective_function, search_space, n_iter=n_iter, n_jobs=2, memory=True |
|
225 | ) |
|
226 | hyper0.run() |
|
227 | d_time_1 = time.perf_counter() - c_time |
|
228 | ||
229 | search_data0 = hyper0.search_data(objective_function) |
|
230 | ||
231 | c_time = time.perf_counter() |
|
232 | hyper1 = Hyperactive() |
|
233 | hyper1.add_search( |
|
234 | objective_function, |
|
235 | search_space, |
|
236 | n_iter=n_iter, |
|
237 | memory_warm_start=search_data0, |
|
238 | memory=True, |
|
239 | ) |
|
240 | hyper1.run() |
|
241 | d_time_2 = time.perf_counter() - c_time |
|
242 | ||
243 | d_time_frac = d_time_1 / d_time_2 |
|
244 | ||
245 | print("\n d_time_1 ", d_time_1) |
|
246 | print("\n d_time_2 ", d_time_2) |
|
247 | ||
248 | assert d_time_frac > 1.5 |
|
249 | ||
250 | ||
251 | @pytest.mark.parametrize("search_space", search_space_list) |
|
@@ 251-281 (lines=31) @@ | ||
248 | assert d_time_frac > 1.5 |
|
249 | ||
250 | ||
251 | @pytest.mark.parametrize("search_space", search_space_list) |
|
252 | def test_memory_warm_start_1(search_space): |
|
253 | n_iter = 1500 |
|
254 | ||
255 | c_time = time.perf_counter() |
|
256 | hyper0 = Hyperactive() |
|
257 | hyper0.add_search(objective_function, search_space, n_iter=n_iter, memory=True) |
|
258 | hyper0.run() |
|
259 | d_time_1 = time.perf_counter() - c_time |
|
260 | ||
261 | search_data0 = hyper0.search_data(objective_function) |
|
262 | ||
263 | c_time = time.perf_counter() |
|
264 | hyper1 = Hyperactive(distribution="pathos") |
|
265 | hyper1.add_search( |
|
266 | objective_function, |
|
267 | search_space, |
|
268 | n_iter=n_iter, |
|
269 | n_jobs=2, |
|
270 | memory=True, |
|
271 | memory_warm_start=search_data0, |
|
272 | ) |
|
273 | hyper1.run() |
|
274 | d_time_2 = time.perf_counter() - c_time |
|
275 | ||
276 | d_time_frac = d_time_1 / d_time_2 |
|
277 | ||
278 | print("\n d_time_1 ", d_time_1) |
|
279 | print("\n d_time_2 ", d_time_2) |
|
280 | ||
281 | assert d_time_frac > 1.5 |
|
282 | ||
283 | ||
284 | @pytest.mark.parametrize("search_space", search_space_list) |
@@ 313-343 (lines=31) @@ | ||
310 | """ |
|
311 | ||
312 | ||
313 | @pytest.mark.parametrize("search_space", search_space_list) |
|
314 | def test_memory_warm_start_1(search_space): |
|
315 | n_iter = 1500 |
|
316 | ||
317 | c_time = time.perf_counter() |
|
318 | hyper0 = Hyperactive() |
|
319 | hyper0.add_search(objective_function, search_space, n_iter=n_iter, memory=True) |
|
320 | hyper0.run() |
|
321 | d_time_1 = time.perf_counter() - c_time |
|
322 | ||
323 | search_data0 = hyper0.search_data(objective_function) |
|
324 | ||
325 | c_time = time.perf_counter() |
|
326 | hyper1 = Hyperactive(distribution="joblib") |
|
327 | hyper1.add_search( |
|
328 | objective_function, |
|
329 | search_space, |
|
330 | n_iter=n_iter, |
|
331 | n_jobs=1, |
|
332 | memory=True, |
|
333 | memory_warm_start=search_data0, |
|
334 | ) |
|
335 | hyper1.run() |
|
336 | d_time_2 = time.perf_counter() - c_time |
|
337 | ||
338 | d_time_frac = d_time_1 / d_time_2 |
|
339 | ||
340 | print("\n d_time_1 ", d_time_1) |
|
341 | print("\n d_time_2 ", d_time_2) |
|
342 | ||
343 | assert d_time_frac > 1.5 |
|
344 | ||
345 | ||
346 | """ |