File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -326,6 +326,15 @@ tune_cluster_loop_iter <- function(split,
326326 load_pkgs(workflow )
327327 load_namespace(control $ pkgs )
328328
329+ # After package loading to avoid potential package RNG manipulation
330+ if (! is.null(seed )) {
331+ # `assign()`-ing the random seed alters the `kind` type to L'Ecuyer-CMRG,
332+ # so we have to ensure it is restored on exit
333+ old_kind <- RNGkind()[[1 ]]
334+ assign(" .Random.seed" , seed , envir = globalenv())
335+ on.exit(RNGkind(kind = old_kind ), add = TRUE )
336+ }
337+
329338 control_parsnip <- parsnip :: control_parsnip(verbosity = 0 , catch = TRUE )
330339 control_workflow <- workflows :: control_workflow(control_parsnip )
331340
Original file line number Diff line number Diff line change 118118 # A tibble: 2 x 4
119119 splits id .metrics .notes
120120 <list> <chr> <list> <list>
121- 1 <split [16/16]> Fold1 <tibble [6 x 5]> <tibble [0 x 3]>
122- 2 <split [16/16]> Fold2 <tibble [6 x 5]> <tibble [0 x 3]>
121+ 1 <split [16/16]> Fold1 <tibble [4 x 5]> <tibble [0 x 3]>
122+ 2 <split [16/16]> Fold2 <tibble [4 x 5]> <tibble [0 x 3]>
123123
124124# select_best() and show_best() works
125125
You can’t perform that action at this time.
0 commit comments