marginTree.predict {marginTree}R Documentation

Prediction from the margin tree classifier

Description

A function to predict from the margin tree classifier

Usage

marginTree.predict(train.obj,x, threshold=1)

Arguments

train.obj Output from call to marginTree
x Data of feature values, n samples by p features
threshold Threshold values for feature selection. Between 1 and 0.)

Details

marginTree.predict yields class predictions from a margin tree classifier.

Value

Vector of predicted values

Author(s)

Robert Tibshirani and Trevor Hastie

References

Rob Tibshirani and Trevor Hastie. Tech report. Feb. 2006. Margin trees for high-dimensional classification Available at http://www-stat.stanford.edu/~tibs/research.html

Examples

#generate some data with 5 classes and 100 features

set.seed(543)
x=matrix(rnorm(40*1000),nrow=40)
y=sort(rep(1:5,8))
x[y==2 | y==3, 1:50]=x[y==2|y==3, 1:50]+1
x[y==3,51:100]=x[y==3,51:100]+1
x[y==4|y==5,1:50]=x[y==4|y==5,1:50]-1
x[y==5, 51:100]=x[y==5,51:100]+1

#generate some test data
xx=x+5*matrix(rnorm(40*1000),nrow=40)
yy=y

#train the classifier

train.obj<-   marginTree(x,y)

# get predictions for test data
marginTree.predict(train.obj,xx)

[Package marginTree version 1.00 Index]