ada(x,...)
"ada"(x, y,test.x,test.y=NULL, loss=c("exponential","logistic"), type=c("discrete","real","gentle"),iter=50, nu=0.1, bag.frac=0.5, model.coef=TRUE,bag.shift=FALSE,max.iter=20,delta=10^(-10), verbose=FALSE,...,na.action=na.rpart)
"ada"(formula, data, ..., subset, na.action=na.rpart)
rpart.control
. For stumps, use rpart.control(maxdepth=1,cp=-1,minsplit=0,xval=0)
.
maxdepth
controls the depth of trees, and cp
controls the complexity of trees. The priors should also
be fixed through the parms argument as discussed in the
second reference.When using usage ada(x,y): x data can take the form data.frame or as.matrix. y data can take form data.frame, as.factor, as.matrix, as.array, or as.table. Missing values must be removed from the data prior to execution.
When using usage ada(y~.): data must be in a data frame. Response can have factor or numeric values. Missing values can be present in the descriptor data, whenever na.action is set to any option other than na.pass. After the model is fit, ada prints a summary of the function call, the method used for boosting, the number of iterations, the final confusion matrix (observed classification vs predicted classification; labels for classes are same as in response), the error for the training set, and testing, training , and kappa estimates of the appropriate number of iterations.
A summary of this information can also be obtained with the command print(x).
Corresponding functions (Use help with summary.ada, predict.ada, ... varplot for additional information on these commands):
summary : function to print a summary of the original function call, method used for boosting, number of iterations, final confusion matrix, accuracy, and kappa statistic (a measure of agreement between the observed classification and predicted classification). summary can be used for training, testing, or validation data.
predict : function to predict the response for any data set (train, test, or validation).
plot : function to plot performance of the algorithm across boosting iterations. Default plot is iteration number (x-axis) versus prediction error (y-axis) for the data set used to build the model. Function can also simultaneously produce an error plot for an external test set and a kappa plot for training and test sets.
pairs : function to produce pairwise plots of descriptors. Descriptors are arranged by decreasing frequency of selection by boosting (upper left = most frequently chosen). The color of the marker in the plot represents class membership; the Size of the marker represents predicted class probability. The larger the marker, the higher the probability of classification.
varplot : plot of variables ordered by the variable importance measure (based on improvement).
addtest : add a testing data set to the ada
object, therefore the testing errors only have to
be computed once.
update : add more trees to the ada
object.
Friedman, J., Hastie, T., and Tibshirani, R. (2000). Additive Logistic Regression: A statistical view of boosting. Annals of Statistics, 28(2), 337-374.
Friedman, J. (2002). Stochastic Gradient Boosting. Coputational Statistics \& Data Analysis 38.
Culp, M., Johnson, K., Michailidis, G. (2006). ada: an R Package for Stochastic Boosting Journal of Statistical Software, 16.
print.ada
,summary.ada
,predict.ada
plot.ada
,pairs.ada
,update.ada
addtest
## fit discrete ada boost to a simple example
data(iris)
##drop setosa
iris[iris$Species!="setosa",]->iris
##set up testing and training data (60% for training)
n<-dim(iris)[1]
trind<-sample(1:n,floor(.6*n),FALSE)
teind<-setdiff(1:n,trind)
iris[,5]<- as.factor((levels(iris[,5])[2:3])[as.numeric(iris[,5])-1])
##fit 8-split trees
gdis<-ada(Species~.,data=iris[trind,],iter=20,nu=1,type="discrete")
##add testing data set
gdis=addtest(gdis,iris[teind,-5],iris[teind,5])
##plot gdis
plot(gdis,TRUE,TRUE)
##variable selection plot
varplot(gdis)
##pairwise plot
pairs(gdis,iris[trind,-5],maxvar=2)
##for many more examples refer to reference (Culp et al., 2006)
Run the code above in your browser using DataLab