Learn R Programming

daltoolbox (version 1.3.727)

feature_selection_stepwise: Feature selection by stepwise model selection

Description

Select features using stepwise search over generalized linear models.

Usage

feature_selection_stepwise(
  attribute,
  features = NULL,
  direction = "forward",
  family = stats::binomial,
  trace = 0
)

Value

returns an object of class feature_selection_stepwise

Arguments

attribute

target attribute name

features

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

direction

stepwise direction: "forward", "backward", or "both"

family

glm family passed to stats::glm (default: binomial)

trace

level of tracing from stats::step

Details

Supports forward, backward, and both directions via stats::step.

Examples

Run this code
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_stepwise("IsVersicolor", direction = "forward")
fs <- fit(fs, iris_bin)
fs$selected
transform(fs, iris_bin) |> names()

Run the code above in your browser using DataLab