feature_selection_relief: Feature selection by ReliefF

View source: R/trans_feature_selection_relief.R

feature_selection_reliefR Documentation

Feature selection by ReliefF

Description

Rank and select features using the ReliefF weighting scheme.

Usage

feature_selection_relief(
  attribute,
  features = NULL,
  top = NULL,
  cutoff = NULL,
  m = 50,
  k = 10,
  seed = NULL
)

Arguments

attribute

target attribute name

features

optional vector of feature names (default: all columns except attribute)

top

optional number of top features to keep

cutoff

optional minimum ReliefF weight to keep a feature

m

number of sampled instances for ReliefF updates

k

number of nearest hits/misses per class averaged in each update (default 10)

seed

optional seed for the instance sampling (reproducibility)

Details

For each of m sampled instances the algorithm finds its k nearest neighbors of the same class (nearest hits) and its k nearest neighbors of each other class (nearest misses) in the normalized feature space, and updates every feature's weight by subtracting its average hit difference and adding its average miss difference, the latter weighted by each other class's prior probability P(C) / (1 - P(class(R))). Averaging over k neighbors (ReliefF, Kononenko 1994) makes the estimate robust to noise, and the class-prior weighting handles multi-class targets.

Inspired by the original Relief and evolved to full ReliefF (see references).

Value

returns an object of class feature_selection_relief

References

Kira, K. and Rendell, L. A. (1992). A Practical Approach to Feature Selection. In Proceedings of the Ninth International Workshop on Machine Learning, 249-256. Kononenko, I. (1994). Estimating Attributes: Analysis and Extensions of RELIEF. In Proceedings of the European Conference on Machine Learning, 171-182.

Examples

data(iris)
fg <- feature_generation(
 IsVersicolor = ifelse(Species == "versicolor", "versicolor", "not_versicolor")
)
iris_bin <- transform(fg, iris)
iris_bin$IsVersicolor <- factor(iris_bin$IsVersicolor)
fs <- feature_selection_relief("IsVersicolor", top = 2, m = 50)
fs <- fit(fs, iris_bin)
fs$selected
transform(fs, iris_bin) |> names()

daltoolbox documentation built on Nov. 23, 2026, 9:08 a.m.