data(abr1)
dat <- abr1$pos
x <- preproc(dat[,110:500], method="log10")
y <- factor(abr1$fact$class)
dat <- dat.sel(x, y, choices=c("1","6"))
x.1 <- dat[[1]]$dat
y.1 <- dat[[1]]$cls
idx <- sample(1:nrow(x.1), round((2/3)*nrow(x.1)), replace=FALSE)
## construct train and test data
train.dat <- x.1[idx,]
train.cl <- y.1[idx]
test.dat <- x.1[-idx,]
test.cl <- y.1[-idx]
## validate feature selection on some feature subsets
res <- frank.err(train.dat, train.cl, test.dat, test.cl,
cl.method="knn", fs.method="fs.auc",
fs.len="power2")
names(res)
## full feature order list
res$fs.order
## validation on subsets of feature order
res$error
## or first apply feature selection
fs <- fs.auc(train.dat,train.cl)
## then apply error estimation for each selected feature subset
res.1 <- frank.err(train.dat, train.cl, test.dat, test.cl,
cl.method="knn", fs.order=fs$fs.order,
fs.len="power2")
res.1$error
Run the code above in your browser using DataLab