| mlr_graphs_bagging | R Documentation |
Creates a Graph that performs bagging for a supplied graph.
This is done as follows:
Subsample the data in each step using PipeOpSubsample, afterwards apply graph
Replicate this step iterations times (in parallel via multiplicities)
Average outputs of replicated graphs predictions using the averager
(note that setting collect_multipliciy = TRUE is required)
All input arguments are cloned and have no references in common with the returned Graph.
pipeline_bagging(
graph,
iterations = 10,
frac = 0.7,
averager = NULL,
replace = FALSE
)
graph |
|
iterations |
|
frac |
|
averager |
|
replace |
|
Graph
library(mlr3)
lrn_po = po("learner", lrn("regr.rpart"))
task = mlr_tasks$get("boston_housing")
gr = pipeline_bagging(lrn_po, 3, averager = po("regravg", collect_multiplicity = TRUE))
resample(task, GraphLearner$new(gr), rsmp("holdout"))$aggregate()
# The original bagging method uses boosting by sampling with replacement.
gr = ppl("bagging", lrn_po, frac = 1, replace = TRUE,
averager = po("regravg", collect_multiplicity = TRUE))
resample(task, GraphLearner$new(gr), rsmp("holdout"))$aggregate()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.