directFeatureSelection: Direct Feature Selection Proccess

Description Usage Arguments Value Author(s) References Examples

View source: R/directFeatureSelection.R

Description

Performs the direct feature selection process. Given a direct search algorithm and an evaluation method, it uses the direct search algorithm in combination with the evaluation results to guide the feature selection process to an optimal subset.

Usage

1
directFeatureSelection(data, class, directSearcher, 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. 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

directSearcher

The algorithm to conduct the direct feature search. See directSearchAlgorithm.

evaluator

The evaluation method to obtain a measure of the features. The evaluation method can be a filter (see filterEvaluator) or a wrapper method (see wrapperEvaluator).

Value

A list is returned with the results of the direct feature selection process:

bestFeatures

A vector with all features. Selected features are marked with 1, unselected features are marked with 0.

featuresSelected

The names of the returned features sorted according to the result of the evaluation measure

valuePerFeature

The evaluation measures of the returned features

evaluationType

Type of evaluation based on how the features have been evaluated.

evaluationMethod

Evaluation method used.

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

\insertAllCited

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Not run:  

## Examples of the direct feature selection process
## Classification problem with filter

# Generates the filter evaluation function
filter_evaluator <- filterEvaluator('ReliefFeatureSetMeasure')
# Generates the direct search function
direct_search_method <- directSearchAlgorithm('selectKBest')
# Runs the direct feature selection process
res <- directFeatureSelection(iris, 'Species', direct_search_method, filter_evaluator)


## Classification problem with wrapper

# Generates the wraper evaluation function
wrapper_evaluator <- wrapperEvaluator('knn')
# Generates the direct search function
direct_search_method <- directSearchAlgorithm('selectKBest')
# Runs the direct feature selection process
res <- directFeatureSelection(iris, 'Species', direct_search_method, wrapper_evaluator)


## Examples of the direct feature selection process (with parameters)
## Regression problem with filter

# Generates the filter evaluation function
filter_evaluator <- filterEvaluator('relief', list(neighbours.count = 4))
# Generates the direct search function
direct_search_method <- directSearchAlgorithm('selectKBest', list(k=2))
# Runs the direct feature selection process
res <- directFeatureSelection(mtcars, 'mpg', direct_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 direct search function
direct_search_method <- directSearchAlgorithm('selectKBest',list(k=2))
# Runs the direct feature selection process
res <- directFeatureSelection(mtcars, 'mpg', direct_search_method, wrapper_evaluator)

## End(Not run)

FSinR documentation built on Nov. 23, 2020, 5:10 p.m.