feat.rank.re: Feature Ranking with Resampling Method

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mt_fs.R

Description

Feature selection with resampling method.

Usage

1
  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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## 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 Feb. 2, 2022, 1:07 a.m.