Closed PhilippPro closed 9 years ago
Hi,
It is possible to use several wrappers on top of each other.
I guess you would like to do something like this (otherwise please let me know):
library(mlr)
## classification task
data(PimaIndiansDiabetes2, package = "mlbench")
task = makeClassifTask(target = "diabetes", data = PimaIndiansDiabetes2)
## make an imputation wrapper
lrn = makeImputeWrapper("classif.lda", classes = list(numeric = imputeMean()))
## make a filter wrapper
lrn = makeFilterWrapper(lrn, fw.method = "chi.squared", fw.perc = 0.5)
r = resample(lrn, task, resampling = makeResampleDesc("Holdout"), models = TRUE)
r
## find out which features have been selected
sapply(r$models, getFilteredFeatures)
In each resampling iteration first the training data is imputed and second features are selected. Then the test data set is imputed in the same manner (using the means calculated on the training data) and a prediction is made based on the selected features.
Thanks, that was what I was asking for. In my example it did not work, but it was because of other reasons.
You're welcome.
Closing this issue now.
Hi,
is there a possibility to make an ImputeWrapper AND FilterWrapper (first Impute, then Filter)? Or is it necessary to do it with a PreprocWrapper?