featureSelection {FSinR} | R Documentation |
Feature Selection Proccess
Description
Performs the feature selection process. Given a search algorithm and an evaluation method, it uses the search algorithm in combination with the evaluation results to guide the feature selection process to an optimal subset.
Usage
featureSelection(data, class, searcher, evaluator)
Arguments
data |
A data.frame with the input dataset where the examples are in the rows and the features and the target variable are in the columns. The dataset should be discrete (feature columns are expected to be factors) if the following filter methods are used as evaluation methods: Rough Set Consistency, Binary Consistency, IE Consistency, IEP Consistency, Mutual Information, Gain Ratio, Symmetrical Uncertain, Gini Index or MDLC. If Ant Colony Optimization is used as a search strategy, the dataset must be numerical since heuristics only work with continuous values. The Jd and F-Score filter methods only work on classification problems with 2 classes in the target variable. |
class |
The name of the dependent variable |
searcher |
The algorithm to guide the search in the feature space. See |
evaluator |
The evaluation method to obtain a measure of the features. The evaluation method can be a filter (see |
Value
A list is returned with the results of the feature selection process:
- bestFeatures
A vector with all features. Selected features are marked with 1, unselected features are marked with 0.
- bestValue
Evaluation measure obtained with the feature selection.
- evaluationType
Type of evaluation based on how the features have been evaluated.
- evaluationMethod
Evaluation method used.
- measureType
Type of evaluation measure.
- searchMethod
Search method used during the feature selection process.
- target
A character indicating if the objective of the process is to minimize or maximize the evaluation measure.
- numFeatures
Number of features in the problem.
- xNames
Name of the features.
- yNames
Name of the dependent variable.
- time
Value of class 'proc_time' containing the user time, system time, and total time of the feature selection process.
Author(s)
Francisco Aragón Royón
References
There are no references for Rd macro \insertAllCites
on this help page.
Examples
## Not run:
## Examples of the feature selection process
## Classification problem with filter
# Generates the filter evaluation function
filter_evaluator <- filterEvaluator('ReliefFeatureSetMeasure')
# Generates the search function
search_method <- searchAlgorithm('hillClimbing')
# Runs the feature selection process
res <- featureSelection(iris, 'Species', search_method, filter_evaluator)
## Classification problem with wrapper
# Generates the wraper evaluation function
wrapper_evaluator <- wrapperEvaluator('knn')
# Generates the search function
search_method <- searchAlgorithm('hillClimbing')
# Runs the feature selection process
res <- featureSelection(iris, 'Species', search_method, wrapper_evaluator)
## Examples of the feature selection process (with parameters)
## Regression problem with filter
# Generates the filter evaluation function
filter_evaluator <- filterEvaluator('ReliefFeatureSetMeasure', list(iterations = 10))
# Generates the search function
search_method <- searchAlgorithm('hillClimbing', list(repeats=2))
# Runs the feature selection process
res <- featureSelection(mtcars, 'mpg', search_method, filter_evaluator)
## Regression problem with wrapper
# Values for the caret trainControl function (resampling parameters)
resamplingParams <- list(method = "cv", repeats = 5)
# Values for the caret train function (fitting parameters)
fittingParams <- list(preProc = c("center", "scale"), metric="RMSE",
tuneGrid = expand.grid(k = c(1:12)))
# Generates the wraper evaluation function
wrapper_evaluator <- wrapperEvaluator('knn', resamplingParams, fittingParams)
# Generates the search function
search_method <- searchAlgorithm('geneticAlgorithm',list(popSize=10, maxiter=25, verbose=TRUE))
# Runs the feature selection process
res <- featureSelection(mtcars, 'mpg', search_method, wrapper_evaluator)
## End(Not run)