mlr_graphs_robustify | R Documentation |
Creates a Graph
that can be used to robustify any subsequent learner.
Performs the following steps:
Drops empty factor levels using PipeOpFixFactors
Imputes numeric
features using PipeOpImputeHist
and PipeOpMissInd
Imputes factor
features using PipeOpImputeOOR
Encodes factors
using one-hot-encoding
. Factors with a cardinality > max_cardinality are
collapsed using PipeOpCollapseFactors
The graph is built conservatively, i.e. the function always tries to assure everything works. If a learner is provided, some steps can be left out, i.e. if the learner can deal with factor variables, no encoding is performed.
All input arguments are cloned and have no references in common with the returned Graph
.
pipeline_robustify(
task = NULL,
learner = NULL,
impute_missings = NULL,
factors_to_numeric = NULL,
max_cardinality = 1000,
ordered_action = "factor",
character_action = "factor",
POSIXct_action = "numeric"
)
task |
|
learner |
|
impute_missings |
|
factors_to_numeric |
|
max_cardinality |
|
ordered_action |
|
character_action |
|
POSIXct_action |
|
Graph
library(mlr3)
lrn = lrn("regr.rpart")
task = mlr_tasks$get("boston_housing")
gr = pipeline_robustify(task, lrn) %>>% po("learner", lrn)
resample(task, GraphLearner$new(gr), rsmp("holdout"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.