Calculating the margins of a classifier
A margin is a measure of the certainty of classification. This method calculates the difference between the support of a correct class and the maximum support of an incorrect class. In this recipe, we will demonstrate how to calculate the margins of the generated classifiers.
You need to have completed the previous recipe by storing a fitted bagging model in the variables,
churn.predbagging. Also, put the fitted boosting classifier in both
How to do it...
Perform the following steps to calculate the margin of each ensemble learner:
- First, use the
marginsfunction to calculate the margins of the boosting classifiers:
> boost.margins = margins(churn.boost, ...