Two examples of functions that can be used in variable selection for classification. The outcome of these functions should be maximized by the optimization.
lda.loofun(x, grouping, subset, ...)
pls.cvfun(x, response, subset, ...)
Data matrix: independent variables used by eval.fun
Class vector, possibly a factor
Dependent variable, typically a real number
A vector containing the indices of the variables to be included
Further arguments, such as the number of latent
variables to use in plscvfun
One value indicating the quality of the subset
The evaluation function should give high values for good
subsets, and low values for bad subsets. The lda.loofun
function simply counts the number of correct predictions in LOO
crossvalidation, and subtracts the number of variables in the
subset. Function pls.cvfun
returns the mean squared error of
cross-validation.
R. Wehrens. "Chemometrics with R - Multivariate Data Analysis in the Natural Sciences and Life Sciences". Springer, Heidelberg, 2011.