feature_selection_info_gain: Feature selection by information gain

View source: R/trans_feature_selection_info_gain.R

feature_selection_info_gainR Documentation

Feature selection by information gain

Description

Rank and select features using information gain with optional discretization.

Usage

feature_selection_info_gain(
  attribute,
  features = NULL,
  top = NULL,
  cutoff = 0,
  bins = 3
)

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

minimum information gain to keep a feature (default: 0)

bins

number of quantile bins for numeric features

Details

Numeric predictors are discretized by quantile bins before computing entropy-based information gain.

Value

returns an object of class feature_selection_info_gain

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_info_gain("IsVersicolor", top = 2)
fs <- fit(fs, iris_bin)
fs$selected
iris_fs <- transform(fs, iris_bin)
names(iris_fs)

daltoolbox documentation built on May 14, 2026, 9:06 a.m.