Textrecipes series: TF-IDF | Emil Hvitfeldt

Hi,

I've been working through Emil's recent blog post: https://www.hvitfeldt.me/blog/textrecipes-series-tfidf/

If I comment out

doParallel::registerDoParallel()

things run fine. If I leave

doParallel::registerDoParallel() 

in the script, the line

lasso_grid <- tune_grid(
  lasso_wf,
  resamples = wine_boot,
  grid = param_grid
)

fails with

Warning message:
All models failed in tune_grid(). See the `.notes` column.

and

lasso_grid$.notes
[[1]]
# A tibble: 1 x 1
  .notes                                                              
  <chr>                                                               
1 "recipe: Error in UseMethod(\"prep\"): no applicable method for 'pr~

The following diagnostics work:

doParallel::registerDoParallel()
getDoParName()

"doParallelSNOW"

getDoParWorkers()

3

getDoParVersion()

"1.0.15"

detectCores()
8

And

library(doParallel)
cl <- makeCluster(2)
registerDoParallel(cl)
foreach(i=1:3) %dopar% sqrt(i)

runs fine

I'm using R3.6, doParallel 1.0.15, tidymodels 0.1.0, recipes 0.1.12, tune 0.1.0 and RStudio 1.3.959
OS is Windows 10.

It appears that this is an issue with how windows handles parallel computing in R.

A similar issue popped up on stackoverflow which might be helpful. :slight_smile:

1 Like

Thanks Emil!

The error in the StackOverflow question looks the same.

I tried

all_cores <- parallel::detectCores(logical = FALSE)
cl <- makePSOCKcluster(all_cores)
registerDoParallel(cl)

and

library(doFuture)
registerDoFuture()
all_cores <- parallel::detectCores(logical = FALSE)
cl <- makeCluster(all_cores)
plan(cluster, workers = cl)

though I get the same error in each case.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.