Perform the following steps to calculate the margin of each ensemble learner:
- First, use the margins function to calculate the margins of the boosting classifiers:
> boost.margins = margins(churn.boost, trainset) > boost.pred.margins = margins(churn.boost.pred, testset)
- You can then use the plot function to plot a marginal cumulative distribution graph of the boosting classifiers:
> plot(sort(boost.margins[[1]]), (1:length(boost.margins[[1]]))/length(boost.margins[[1]]), type="l",xlim=c(-1,1),main="Boosting: Margin cumulative distribution graph", xlab="margin", ylab="% observations", col = "blue") > lines(sort(boost.pred.margins[[1]]) (1:length(boost.pred.margins[[1]]))/length(boost.pred.margins[[1]]) , type="l", col ...