@@ -226,6 +226,35 @@ test_that("ArchiveAsyncTuning as.data.table function works with switched new ids
226
226
expect_rush_reset(instance $ rush )
227
227
})
228
228
229
+ test_that(" Saving ArchiveAsyncTuning works" , {
230
+ skip_on_cran()
231
+ skip_if_not_installed(" rush" )
232
+ flush_redis()
233
+
234
+ on.exit({
235
+ file.remove(" instance.rds" )
236
+ })
237
+
238
+ rush :: rush_plan(n_workers = 2 )
239
+ instance = ti_async(
240
+ task = tsk(" pima" ),
241
+ learner = lrn(" classif.rpart" , cp = to_tune(1e-04 , 1e-1 )),
242
+ resampling = rsmp(" cv" , folds = 3 ),
243
+ measures = msr(" classif.ce" ),
244
+ terminator = trm(" evals" , n_evals = 20 ),
245
+ store_benchmark_result = TRUE
246
+ )
247
+ tuner = tnr(" async_random_search" )
248
+ tuner $ optimize(instance )
249
+
250
+ saveRDS(instance , file = " instance.rds" )
251
+
252
+ loaded_instance = readRDS(file = " instance.rds" )
253
+
254
+ loaded_instance $ reconnect()
255
+ loaded_instance
256
+ })
257
+
229
258
# Internal Tuning --------------------------------------------------------------
230
259
231
260
test_that(" ArchiveAsyncTuning as.data.table function works internally tuned values" , {
@@ -254,3 +283,4 @@ test_that("ArchiveAsyncTuning as.data.table function works internally tuned valu
254
283
expect_names(names(tab ), must.include = " internal_tuned_values_iter" )
255
284
expect_equal(tab $ internal_tuned_values_iter [1 ], 99 )
256
285
})
286
+
0 commit comments