feat.rank.re: Feature Ranking with Resampling Method

View source: R/mt_fs.R

feat.rank.reR Documentation

Feature Ranking with Resampling Method

Description

Feature selection with resampling method.

Usage

  feat.rank.re(x,y,method=,pars = valipars(),tr.idx=NULL,...)

Arguments

x

A matrix or data frame containing the explanatory variables.

y

A factor specifying the class for each observation.

method

Feature selection method to be used. For each method used in this function, the output must be a list including two components, fs.rank (rank scores of features) and fs.order(feature orders in descending order).

pars

A list of resampling scheme method such as Leave-one-out cross-validation, Cross-validation, Bootstrap and Randomised validation (holdout). See valipars for details.

tr.idx

User defined index of training samples. Can be generated by trainind.

...

Additional parameters to method.

Value

A list with components:

method

Feature selection method used.

fs.rank

A vector of final feature ranking list.

fs.order

A vector of final feature order from best to worst.

rank.list

Feature rank lists of all computation.

order.list

Feature order lists of all computation.

pars

Resampling parameters.

tr.idx

Index of training samples.

all

All results come from re-sampling.

Author(s)

Wanchang Lin

See Also

valipars, feat.freq, frankvali

Examples

## prepare data set
data(abr1)
cls <- factor(abr1$fact$class)
dat <- abr1$pos
## dat <- abr1$pos[,110:1930]

## fill zeros with NAs
dat <- mv.zene(dat)

## missing values summary
mv <- mv.stats(dat, grp=cls) 
## mv    ## View the missing value pattern

## filter missing value variables
## dim(dat)
dat <- dat[,mv$mv.var < 0.15]
## dim(dat)

## fill NAs with mean
dat <- mv.fill(dat,method="mean")

## log transformation
dat <- preproc(dat, method="log10")

## select class "1" and "2" for feature ranking
ind <- which(cls==1 | cls==2)
x   <- dat[ind,,drop=FALSE] 
y   <- cls[ind, drop=TRUE]   

## feature selection
pars   <- valipars(sampling="boot",niter=2,nreps=5)
tr.idx <- trainind(y,pars=pars)

z      <- feat.rank.re(x,y,method="fs.auc",pars = pars)
names(z)
               

mt documentation built on June 22, 2024, 12:24 p.m.