FeatureImp fails when using mlr PreprocWrapper using parallel processing
- Dominant language
- R
- Stars
- 503
- Forks
- 87
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
First of all, iml is an awesome package and I want to say thank you for you effort on it.
I'm getting a weird problem when using a mlr model with preprocessing only when using parallel processing: no applicable method for 'predict' applied to an object of class "preProcess"
Reproducible example below:
```
library(mlr)
library(ranger)
library(iml)
data("iris")
tsk = mlr::makeClassifTask(data = iris, target = "Species")
lrn = mlr::makeLearner("classif.ranger", predict.type = "prob")
preproc_lrn = mlr::makePreprocWrapperCaret(lrn)
mod = mlr:::train(preproc_lrn, tsk)
X = iris[which(names(iris) != "Species")]
predictor = Predictor$new(mod, data = X, y = iris$Species)
library("doParallel")
cl = makePSOCKcluster(2)
registerDoParallel(cl)
imp = FeatureImp$new(predictor, loss = "ce", parallel = TRUE)
stopCluster(cl)
```
If I don't use a parallel backend it works perfectly:
`imp = FeatureImp$new(predictor, loss = "ce")`
Contributor guide
Assessment
This issue has not been assessed yet.