mlr-org / mlr3pipelines

Dataflow Programming for Machine Learning in R
https://mlr3pipelines.mlr-org.com/
GNU Lesser General Public License v3.0
137 stars 25 forks source link

add pipeline stacking #589

Closed be-marc closed 3 years ago

be-marc commented 3 years ago

Function to create a simple stacking pipeline like https://github.com/mlr-org/mlr/blob/main/man/makeStackedLearner.Rd.

library(mlr3verse)
library(mlr3pipelines)

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("iris"))