Learn R Programming

daltoolboxdp (version 1.2.737)

fs_ig: Information Gain

Description

Information Gain (IG) is an information-theoretic feature selection technique that measures reduction in entropy of the target when a feature is observed. Wraps the FSelector package.

Usage

fs_ig(attribute)

Value

A fs_ig object.

Arguments

attribute

Character. Name of the target variable.

References

Quinlan, J. R. (1986). Induction of Decision Trees.

Examples

Run this code
if (FALSE) {
data(iris)

# 1) Ensure target is a factor for IG-based ranking
iris2 <- iris
iris2$Species <- as.factor(iris2$Species)

# 2) Fit selector and inspect chosen features
fs <- daltoolbox::fit(fs_ig("Species"), iris2)
fs$features                     # names of selected predictors

# 3) Subset data to selected features + target
data_ig <- daltoolbox::transform(fs, iris2)
head(data_ig)
}

Run the code above in your browser using DataLab