Search code examples
rmlr

mlr - Access data between or after preprocessing steps


Is there a way to access the data after performing a preprocessing step using a wrapper in mlr? Here a stripped version of the code:

library(mlr)
library(mlbench)

data <- BreastCancer[, 2:11]
lrn <- makeLearner(cl = "classif.ranger",
                        predict.type = "prob",
                        fix.factors.prediction = TRUE,
                        importance = "permutation")

lrn <- makeImputeWrapper(lrn, classes = list(integer = imputeMedian(),
                                                  numeric = imputeHist(),
                                                  factor = imputeMode()))

lrn <- makeRemoveConstantFeaturesWrapper(lrn, na.ignore = TRUE)

classif.task <- makeClassifTask(data = rawdata, target = "Target", positive = "1")

model <- train(lrn, classif.task)

The code defines a learner, removes constant features and performs imputation. Is there a way to see how the data will look like after the removal of the constant features or, more interestingly, after the imputation?


Solution

  • This isn't implemented at the moment -- the point of the wrappers is to encapsulate everything so that you don't have to worry about the intermediate steps.

    You can however use the impute() function to do the same imputation separately (and similarly for the removal of constant features). See the tutorial for more information.