mlr_graphs_stacking | R Documentation |
Create a new Graph
for stacking. A stacked learner uses predictions of
several base learners and fits a super learner using these predictions as
features in order to predict the outcome.
All input arguments are cloned and have no references in common with the returned Graph
.
pipeline_stacking(
base_learners,
super_learner,
method = "cv",
folds = 3,
use_features = TRUE
)
base_learners |
|
super_learner |
|
method |
|
folds |
|
use_features |
|
Graph
if (requireNamespace("kknn")) {
library(mlr3)
library(mlr3learners)
base_learners = list(
lrn("classif.rpart", predict_type = "prob"),
lrn("classif.kknn", predict_type = "prob")
)
super_learner = lrn("classif.log_reg")
graph_stack = pipeline_stacking(base_learners, super_learner)
graph_learner = as_learner(graph_stack)
graph_learner$train(tsk("german_credit"))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.