New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using parallel processing results in error with tune_grid() #159
Comments
I think this might be a duplicate of #157, or have the same root cause. |
The issue is how library(tidymodels)
#> ── Attaching packages ───────────────────────────────────────────────────────────────────────────────────────── tidymodels 0.0.4 ──
#> ✓ broom 0.5.4 ✓ recipes 0.1.9
#> ✓ dials 0.0.4 ✓ rsample 0.0.5
#> ✓ dplyr 0.8.4 ✓ tibble 2.1.3
#> ✓ ggplot2 3.2.1 ✓ tune 0.0.1.9000
#> ✓ infer 0.5.1 ✓ workflows 0.1.0
#> ✓ parsnip 0.0.5 ✓ yardstick 0.0.5
#> ✓ purrr 0.3.3
#> ── Conflicts ──────────────────────────────────────────────────────────────────────────────────────────── tidymodels_conflicts() ──
#> x purrr::discard() masks scales::discard()
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
#> x ggplot2::margin() masks dials::margin()
#> x recipes::step() masks stats::step()
#> x recipes::yj_trans() masks scales::yj_trans()
library(tune)
library(tidyverse)
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
data(Chicago, package = "modeldata")
holidays <- timeDate::listHolidays() %>%
str_subset("(^US|Easter)")
Chicago_copy <- mutate(Chicago, year = year(date),
day = wday(date, label = TRUE, abbr = FALSE),
year = year(date))
chi_rec <- recipe(ridership ~ ., data = Chicago_copy) %>%
step_holiday(date, holidays = holidays) %>%
step_date(date) %>%
step_rm(date) %>%
step_dummy(recipes::all_nominal()) %>%
step_zv(recipes::all_predictors()) %>%
step_normalize(recipes::all_predictors())
chi_folds <- rolling_origin(Chicago_copy,
initial = 364 * 15,
assess = 7 * 4,
skip = 7 * 4,
cumulative = FALSE)
glmn_grid <- expand_grid(
penalty = 10 ^ seq(-3, -1, length.out = 20),
mixture = (0:5) / 5)
glmn_mod <- linear_reg(penalty = tune(), mixture = tune()) %>%
set_engine("glmnet")
ctrl <- control_grid(save_pred = TRUE)
before_loaded <- names(sessionInfo()$otherPkgs)
library(doParallel)
#> Loading required package: foreach
#>
#> Attaching package: 'foreach'
#> The following objects are masked from 'package:purrr':
#>
#> accumulate, when
#> Loading required package: iterators
#> Loading required package: parallel
cl <- makeCluster(4)
registerDoParallel(cl)
glmn_tune <- tune_grid(chi_rec,
model = glmn_mod,
resamples = chi_folds,
grid = glmn_grid,
control = ctrl)
after_loaded <- names(sessionInfo()$otherPkgs)
after_loaded[!(after_loaded %in% before_loaded)]
#> [1] "doParallel" "iterators" "foreach" Created on 2020-02-16 by the reprex package (v0.3.0) |
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. |
As part of the Applied ML course, I have run into the following error when using parallel processing on a Windows machine.
The text was updated successfully, but these errors were encountered: