marginTree.predict {marginTree} | R Documentation |
A function to predict from the margin tree classifier
marginTree.predict(train.obj,x, threshold=1)
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.) |
marginTree.predict
yields class predictions from a margin tree classifier.
Vector of predicted values
Robert Tibshirani and Trevor Hastie
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
#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)