vip icon indicating copy to clipboard operation
vip copied to clipboard

vi_permute() throws warning: <anonymous>: ... may be used in an incorrect context

Open agilebean opened this issue 3 years ago • 1 comments

The documentation for vi_permute() says about option parallel:

Logical indicating whether or not to run vi_permute() in parallel (using a backend provided by the foreach package). Default is FALSE. If TRUE, an appropriate backend must be provided by foreach.

However, the foreach package does not create a parallel backend. In the vignette and posts of the author, the parallel backend is created by the doParallel package, e.g. by parallel::makeForkCluster()

Using such a backend, the vi() function

times <- system.time(
  model.vi <- model %>%
    vi(
      method = "permute",
      target = ".outcome",
      train = model$trainingData,
      type = "ratio",
      metric = "rmse",
      keep = TRUE,
      parallel = TRUE,
      nsim = 2,
      pred_wrapper = predict
    )

throws the warning

Warning messages:
1: <anonymous>: ... may be used in an incorrect context: ‘.fun(piece, ...)’

What is the reason, and how can it be avoided? Googling this message finds links to the ancient plyr package...

agilebean avatar Jun 03 '21 07:06 agilebean

Will be fixed after removing the plyr dependency; see https://github.com/koalaverse/vip/issues/126.

bgreenwell avatar Aug 14 '21 14:08 bgreenwell