forwardfeatureselection: Forward Feature Selection. Performs forward feature selection...

Description Usage Arguments Value Examples

View source: R/forwardfeatureselection.R

Description

Forward Feature Selection. Performs forward feature selection on the given list of features, placing them in order of discriminative power using a given model on the given dataset up to the accuracy plateau.

Usage

1
2
3
4
5
6
7
forwardfeatureselection(
  model = feamiR::svmlinear,
  training,
  test,
  featurelist,
  includePlot = FALSE
)

Arguments

model

The ML models used to classify the data, typically SVM with a given kernel

training

Training dataset as a data.frame with classification column and column for each feature.

test

Test dataset with matching columns to training.

featurelist

List of features to order

includePlot

Show number of features vs accuracy line plot (default:FALSE)

Value

Ordered list of most discriminative features when classifying the dataset along with training and test accuracy, sensitivity and specificity

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data_train = data.frame(
      classification=as.factor(c(1,1,0,0,1,1,0,0,1,1)),
      A=c(1,1,1,0,0,0,1,1,1,0),
      B=c(0,1,1,0,1,1,0,1,1,0),
      C=c(0,0,1,0,0,1,0,0,1,0),
      D=c(0,1,1,0,0,0,1,0,0,0),
      E=c(1,0,1,0,0,1,0,1,1,0))
data_test = data.frame(
      classification=as.factor(c(1,1,0,0,1,1,1,0)),
      A=c(0,0,0,1,0,0,0,1),
      B=c(1,1,1,0,0,1,1,1),
      C=c(0,0,1,1,0,0,1,1),
      D=c(0,0,1,1,0,1,0,1),
      E=c(0,0,1,0,1,0,1,1))
listoffeatures = colnames(data_train)[colnames(data_train)!='classification']
forwardfeatureselection(feamiR::svmlinear,data_train,data_test,listoffeatures)

feamiR documentation built on Jan. 19, 2021, 9:08 a.m.