marginTree.getnonzero {marginTree}R Documentation

Get important features at each split of the margin tree

Description

A function to get important features at each split of the margin tree

Usage

marginTree.getnonzero(train.obj,  threshold)

Arguments

train.obj Output from call to marginTree
threshold Threshold for feature selection: between 0 and 1

Details

marginTree.getnonzero Does hard thresholding of the weight vector at each split in the margin tree, to select features

Value

A list– one element per split in the tree– with components

feature.scores The coefficient for the selected feature
left.classes The outcome classes assigned to the left branch
right.classes The outcome classes assigned to the right branch

Author(s)

Rob 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

#train the classifier

train.obj<-  marginTree(x,y)

# examine the selected features at each split

junk<- marginTree.getnonzero(train.obj,threshold=.5)

summary(junk)

[Package marginTree version 1.00 Index]