mlr3fselect.svm_rfe {mlr3fselect} | R Documentation |
SVM-RFE Callback
Description
Runs a recursive feature elimination with a mlr3learners::LearnerClassifSVM.
The SVM must be configured with type = "C-classification"
and kernel = "linear"
.
Source
Guyon I, Weston J, Barnhill S, Vapnik V (2002). “Gene Selection for Cancer Classification using Support Vector Machines.” Machine Learning, 46(1), 389–422. ISSN 1573-0565, doi:10.1023/A:1012487302797.
Examples
clbk("mlr3fselect.svm_rfe")
library(mlr3learners)
# Create instance with classification svm with linear kernel
instance = fsi(
task = tsk("sonar"),
learner = lrn("classif.svm", type = "C-classification", kernel = "linear"),
resampling = rsmp("cv", folds = 3),
measures = msr("classif.ce"),
terminator = trm("none"),
callbacks = clbk("mlr3fselect.svm_rfe"),
store_models = TRUE
)
fselector = fs("rfe", feature_number = 5, n_features = 10)
# Run recursive feature elimination on the Sonar data set
fselector$optimize(instance)
[Package mlr3fselect version 1.0.0 Index]