Closed wtbxsjy closed 2 years ago
Due to how future looks up global variables, you need to manually specify that the {recipeselectors} package is needed on the workers. You can do this with control_grid(pkgs = "recipeselectors")
.
library(tidyverse)
library(tidymodels)
library(recipeselectors)
data(cells, package = "modeldata")
cells <- cells %>% select(-case)
rec <-
recipe(class ~ ., data = cells) %>%
step_corr(all_predictors(), threshold = 0.9) %>%
step_select_roc(all_predictors(), outcome = "class", top_p = tune())
mod <- logistic_reg(
penalty = 0.01,
mixture = 1
) %>%
set_engine("LiblineaR") %>%
set_mode("classification")
wflow <-
workflow() %>%
add_recipe(rec) %>%
add_model(mod)
p_info <-
wflow %>%
extract_parameter_set_dials() %>%
update(top_p = top_p(c(1, 30)))
rs <- vfold_cv(cells)
# pass in pkgs here
ctrl <- control_grid(extract = identity, pkgs = "recipeselectors")
library(doFuture)
registerDoFuture()
plan(multisession)
# works
rfe_res <-
mod %>%
tune_grid(
rec,
resamples = rs,
grid = 2,
param_info = p_info,
control = ctrl
)
Created on 2022-03-22 by the reprex package (v2.0.1)
Thanks for your kindly reply, it works.
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.
Hi, I am using recipeselectors for feature selection to speed up the process, I tried doFuture, tune_grid worded fine with plan(sequential), but failed when set plan(multisession) could you help to solve it? here is an example from https://github.com/stevenpawley/recipeselectors/issues/1
here is my packages versions:
Created on 2022-03-22 by the reprex package (v2.0.1)