Plots the previously calculated margins of an AdaBoost.M1, AdaBoost-SAMME or Bagging classifier for a data frame
An object of class
This argument can be used to represent in the same plot
the margins in the test and train sets,
further arguments passed to or from other methods.
Intuitively, the margin for an observation is related to the certainty of its classification. It is calculated as the difference between the support of the correct class and the maximum support of an incorrect class
A labeled plot is produced on the current graphics device (one being opened if needed).
Alfaro, E., Gamez, M. and Garcia, N. (2013): “adabag: An R Package for Classification with Boosting and Bagging”. Journal of Statistical Software, Vol 54, 2, pp. 1–35.
Alfaro, E., Garcia, N., Gamez, M. and Elizondo, D. (2008): “Bankruptcy forecasting: An empirical comparison of AdaBoost and neural networks”. Decision Support Systems, 45, pp. 110–122.
Schapire, R.E., Freund, Y., Bartlett, P. and Lee, W.S. (1998): “Boosting the margin: A new explanation for the effectiveness of voting methods”. The Annals of Statistics, vol 26, 5, pp. 1651–1686.
1 2 3 4 5 6 7 8 9 10 11 12
library(mlbench) data(BreastCancer) l <- length(BreastCancer[,1]) sub <- sample(1:l,2*l/3) cntrl <- rpart.control(maxdepth = 3, minsplit = 0, cp = -1) BC.adaboost <- boosting(Class ~.,data=BreastCancer[sub,-1],mfinal=5, control=cntrl) BC.adaboost.pred <- predict.boosting(BC.adaboost,newdata=BreastCancer[-sub,-1]) BC.margins<-margins(BC.adaboost,BreastCancer[sub,-1]) # training set BC.predmargins<-margins(BC.adaboost.pred,BreastCancer[-sub,-1]) # test set plot.margins(BC.predmargins,BC.margins)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.