Learn R Programming

bst (version 0.3-2)

bst: Boosting for Classification and Regression

Description

Gradient boosting for optimizing hinge or squared error loss functions with componentwise linear, smoothing splines, tree models as base learners.

Usage

bst(x, y, cost = 0.5, family = c("hinge", "gaussian"), ctrl = bst_control(), 
control.tree = list(maxdepth = 1), learner = c("ls", "sm", "tree"))
## S3 method for class 'bst':
print(x, ...)
## S3 method for class 'bst':
predict(object, newdata=NULL, newy=NULL, mstop=NULL, type=c("response", "all.res", "class", "loss", "error"), ...)
## S3 method for class 'bst':
plot(x, type = c("step", "norm"),...)
## S3 method for class 'bst':
coef(object, ...)
## S3 method for class 'bst':
fpartial(object, mstop=NULL, newdata=NULL)

Arguments

x
a data frame containing the variables in the model.
y
vector of responses. y must be in {1, -1} for family = "hinge".
cost
price to pay for false positive, 0 < cost < 1; price of false negative is 1-cost.
family
family = "hinge" for hinge loss and family="gaussian" for squared error loss. Implementing the negative gradient corresponding to the loss function to be minimized. By default, hinge loss for +1/-
ctrl
an object of class bst_control.
control.tree
control parameters of rpart.
learner
a character specifying the component-wise base learner to be used: ls linear models, sm smoothing splines, tree regression trees.
type
in predict a character indicating whether the response, all responses across the boosting iterations, classes, loss or classification errors should be predicted in case of hinge problems. in plot, plo
object
class of bst.
newdata
new data for prediction with the same number of columns as x.
newy
new response.
mstop
boosting iteration for prediction.
...
additional arguments.

Value

  • An object of class bst with print, coef, plot and predict methods are available for linear models. For nonlinear models, methods print and predict are available.

Details

A linear or nonlinear classifier is fitted using a boosting algorithm for +1/-1 responses.

References

Zhu Wang (2011), HingeBoost: ROC-Based Boost for Classification and Variable Selection. The International Journal of Biostatistics, 7(1), Article 13.

See Also

cv.bst for cross-validated stopping iteration. Furthermore see bst_control

Examples

Run this code
x <- matrix(rnorm(100*5),ncol=5)
c <- 2*x[,1]
p <- exp(c)/(exp(c)+exp(-c))
y <- rbinom(100,1,p)
y[y != 1] <- -1
x <- as.data.frame(x)
dat.m <- bst(x, y, ctrl = bst_control(mstop=50), family = "hinge", learner = "ls")
dat.m1 <- bst(x, y, ctrl = bst_control(twinboost=TRUE, 
f.init=predict(dat.m), xselect.init = dat.m$xselect, mstop=50))

Run the code above in your browser using DataLab