Order of preprocessing step in mlr package in R

165 Views Asked by At

Working with already implemented preprocessing Wrappers as well as own Wrappers in mlr, I am wondering in which order the preprocessing steps are computed for the following example?

classif.lrn.net = makePreprocWrapperCaret(classif.lrn.net, ppc.nzv=TRUE, ppc.corr=TRUE, ppc.conditionalX=TRUE, ppc.center=TRUE, ppc.scale=TRUE, ppc.spatialSign=TRUE) 

classif.lrn.net = makeSMOTEWrapper(classif.lrn.net)

classif.lrn.net = makeImputeWrapper(learner=classif.lrn.net, classes = list(numeric = imputeMedian(), integer =imputeMedian()))

From the mlr-Tutorial I know that within the caretPreprocWrapper operations are applied in the following order:

near-zero variance filter, correlation filter, imputation, spatial sign.

Moreover, the SMOTE-Wrapper will be proceeded before (because it comes after the caretWrapper in the code).

But when will the immputationWrapper be proceeded? I think it would be important that the imputation happens before the spatial sign transformation (this order is also implemented in the caretPreprocWrapper). Since I am using my own imputation-Wrapper, I am not sure, if and how I can ensure that the imputation is done in between the different caretPreproc-Steps?

1

There are 1 best solutions below

2
On BEST ANSWER

The way you have specified it, the imputation happens at the beginning of the entire process, and only once (i.e. not in between different caret steps). The outermost wrapper is run first and doesn't know anything about the inner workings of the learner it wraps.