Learn R Programming

adabag (version 5.0)

MarginOrderedPruning.Bagging: MarginOrderedPruning.Bagging

Description

Margin-based ordered aggregation for bagging pruning

Usage

MarginOrderedPruning.Bagging(baggingObject, trainingset, pruningset, 
	marginType = "unsupervised", doTrace = TRUE)

Value

Returns a list with the following components:

prunedBagging

a pruned bagging object

AccuracyOrderedEnsemblePruningSet

Accuracy of each ordered ensemble on pruning set

Arguments

baggingObject

fitted model object of class bagging

trainingset

the training set of the bagging object

pruningset

a set aside dataset for bagging pruning

marginType

if "unsupervised" (by default) the margin is the difference between the proportions of votes of the first and second most popular classes. Else the margin is calculated as the difference between the proportion of votes of the correct class and the most popular among the other classes

doTrace

If set to TRUE, give a more verbose output as MarginOrderedPruning.Bagging is running

Author

Li Guo guoli84@hotmail.com

References

Guo, L. and Boukir, S. (2013): "Margin-based ordered aggregation for ensemble pruning". Pattern Recognition Letters, 34(6), 603-609.

See Also

bagging, predict.bagging

Examples

Run this code
## mlbench package should be loaded
library(mlbench)
data(Satellite)
## Separate data into 3 parts: training set, pruning set and test set
ind <- sample(3, nrow(Satellite), replace = TRUE, prob=c(0.3, 0.2,0.5))

## create bagging with training set
#increase mfinal in your own execution of this example to see 
#the real usefulness of this function
Satellite.bagging<-bagging(classes~.,data=Satellite[ind==1,],mfinal=3)
#Satellite.bagging.pred<-predict(Satellite.bagging,Satellite[ind==3,])

##pruning bagging
Satellite.bagging.pruning<-MarginOrderedPruning.Bagging(Satellite.bagging,
Satellite[ind==1,],Satellite[ind==2,])
#Satellite.bagging.pruning.pred<-predict(Satellite.bagging.pruning$prunedBagging,
#Satellite[ind==3,])

## create bagging with training and pruning set
#This example has been hidden to fulfill execution time <5s 
#Satellite.bagging2<-bagging(classes~.,data=Satellite[ind!=3,],25)
#Satellite.bagging2.pred<-predict(Satellite.bagging2,Satellite[ind==3,])

Run the code above in your browser using DataLab