October 2017
Beginner to intermediate
572 pages
26h 1m
English
Besides adabag, the ipred package provides a bagging method for a classification tree. We demonstrate here how to use the bagging method of the ipred package to train a classification model:
> install.packages("ipred")
> library(ipred)
> churn.bagging = bagging(churn ~ ., data = trainset, coob = T)
> churn.bagging
Output
Bagging classification trees with 25 bootstrap replications
Call: bagging.data.frame(formula = churn ~ ., data = trainset, coob = T)
Out-of-bag estimate of misclassification error: 0.0605
> mean(predict(churn.bagging) ...
Read now
Unlock full access