Learn R Programming

SAM (version 1.0.2)

fastscr: Screening variables before the traning stage

Description

Variables are preselected by t test ot wilcoxon test

Usage

fastscr(x, y, nscr = NULL, method = "t.test")

Arguments

x
The training dataset represented in a n by d matrix, where n is fastscrple size and d is dimension.
y
The labels of training dataset represented in a n by d matrix, where n is fastscrple size and d is dimension. The label must be encoded as either 1 or -1.
nscr
The number of variables retained. The default value is min(n,d).
method
The screening will be based on t.test if method = "t.test"). An alternative is wilcoxon test if method = "wilcox").

Value

  • idxA vector of length nscr corresponding to the indices of retained variables.

Details

The fast screening can greatly reduce the compuational burden, and often achieve equally (or better) performance in practice.

References

T. Zhao and H.Liu. "Sparse Additive Machine", International Conference on Artificial Intelligence and Statistics, 2012. P. Bradley and O. Mangasarian. ""Feature selection via concaveminimization and support vector machines"", International Conference on Machine Learing, 1998.

See Also

SAM,l1svm,spam

Examples

Run this code
## generating training data
x = rbind(0.5+matrix(rnorm(100),50,2),-0.5+matrix(rnorm(100),50,2))
x = cbind(x,matrix(rnorm(7800),100,78))

## generating labels
y = c(rep(1,50),rep(-1,50))

## fast screening
idx = fastscr(x,y,nscr = 10)

## Training
## fit = spam(x[,idx],y,k=4)

Run the code above in your browser using DataLab