Description Usage Arguments Value Examples
View source: R/forwardfeatureselection.R
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.
1 2 3 4 5 6 7 | forwardfeatureselection(
model = feamiR::svmlinear,
training,
test,
featurelist,
includePlot = FALSE
)
|
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) |
Ordered list of most discriminative features when classifying the dataset along with training and test accuracy, sensitivity and specificity
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.