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.

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

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)
#> $feature_list #> [1] "D" "E" "B" "C" #> #> $accuracy #> [1] 0.7 #> #> $testacc #> [1] 0.875 #> #> $trainacc #> [1] 0.7 #> #> $trainsens #> [1] 0 #> #> $trainspec #> [1] 0.25 #> #> $testsens #> [1] 0 #> #> $testspec #> [1] 0.6666667 #>