Skip to content

Selects features for continuous or factor data using ReliefF on a 'tidyFit' R6 class. The function can be used with regress and classify.

Usage

.model.relief(self, data = NULL)

Arguments

self

a 'tidyFit' R6 class.

data

a data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr).

Value

A fitted 'tidyFit' class model.

Details

Hyperparameters:

None. Cross validation not applicable.

Important method arguments (passed to m)

  • estimator (selection algorithm to use (default is 'ReliefFequalK'))

The ReliefF algorithm is estimated using the CORElearn::attrEval function. See ?attrEval for more details.

Implementation

Use with regress for regression problems and with classify for classification problems. coef returns the score for each feature. Select the required number of features with the largest scores.

The Relief objects have no predict and related methods.

References

Robnik-Sikonja M, Savicky P (2021). CORElearn: Classification, Regression and Feature Evaluation. R package version 1.56.0, https://CRAN.R-project.org/package=CORElearn.

See also

.model.mrmr and m methods

Author

Johann Pfitzinger

Examples

# Load data
data <- tidyfit::Factor_Industry_Returns
data <- dplyr::filter(data, Industry == "HiTec")
data <- dplyr::select(data, -Date, -Industry)

# Stand-alone function
fit <- m("relief", Return ~ ., data)
coef(fit)
#> # A tibble: 6 × 3
#>   term   estimate model_info      
#>   <chr>     <dbl> <list>          
#> 1 Mkt-RF   0.211  <tibble [1 × 0]>
#> 2 SMB      0.0250 <tibble [1 × 0]>
#> 3 HML      0.0276 <tibble [1 × 0]>
#> 4 RMW      0.0431 <tibble [1 × 0]>
#> 5 CMA      0.0396 <tibble [1 × 0]>
#> 6 RF      -0.0140 <tibble [1 × 0]>

# Within 'regress' function
fit <- regress(data, Return ~ ., m("relief"))
coef(fit)
#> # A tibble: 6 × 4
#> # Groups:   model [1]
#>   model  term   estimate model_info      
#>   <chr>  <chr>     <dbl> <list>          
#> 1 relief Mkt-RF   0.211  <tibble [1 × 0]>
#> 2 relief SMB      0.0250 <tibble [1 × 0]>
#> 3 relief HML      0.0276 <tibble [1 × 0]>
#> 4 relief RMW      0.0431 <tibble [1 × 0]>
#> 5 relief CMA      0.0396 <tibble [1 × 0]>
#> 6 relief RF      -0.0140 <tibble [1 × 0]>