Description Usage Arguments Examples
View source: R/StackedLearner.R
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. The following stacking methods are available:
average
Averaging of base learner predictions without weights.
stack.nocv
Fits the super learner, where in-sample predictions of the base learners are used.
stack.cv
Fits the super learner, where the base learner predictions are computed
by crossvalidated predictions (the resampling strategy can be set via the resampling
argument).
hill.climb
Select a subset of base learner predictions by hill climbing algorithm.
compress
Train a neural network to compress the model from a collection of base learners.
1 2 3 |
base.learners |
[(list of) |
super.learner |
[ |
predict.type |
[
|
method |
[ |
use.feat |
[ |
resampling |
[ |
parset |
the parameters for
the parameters for
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # Classification
data(iris)
tsk = makeClassifTask(data = iris, target = "Species")
base = c("classif.rpart", "classif.lda", "classif.svm")
lrns = lapply(base, makeLearner)
lrns = lapply(lrns, setPredictType, "prob")
m = makeStackedLearner(base.learners = lrns,
predict.type = "prob", method = "hill.climb")
tmp = train(m, tsk)
res = predict(tmp, tsk)
# Regression
data(BostonHousing, package = "mlbench")
tsk = makeRegrTask(data = BostonHousing, target = "medv")
base = c("regr.rpart", "regr.svm")
lrns = lapply(base, makeLearner)
m = makeStackedLearner(base.learners = lrns,
predict.type = "response", method = "compress")
tmp = train(m, tsk)
res = predict(tmp, tsk)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.