entropy: Entropy for a given split of a categorical variable

View source: R/entropy.R

entropyR Documentation

Entropy for a given split of a categorical variable

Description

Calculates the entropy of a categorical variable for a given split (threshold) value of a numeric variable.

Usage

entropy(x, group, thres)

Arguments

x

A numeric vector

group

Categorical variable

thres

Threshold value to use for the split

Value

A data frame with entropy before and after the split, as well as the gain and gain percent

References

Kuhn, M. & Johnson, K. (2013). Applied Predictive Modeling. Springer.

Witten, I. H., Frank, E. & Hall, M. A. (2011). Data Mining: Practical Machine Learning Tools and Techniques. Elsevier.

Examples

entropy(mtcars$mpg, mtcars$cyl, 15)
entropy(mtcars$mpg, mtcars$cyl, 21)
entropy(mtcars$mpg, mtcars$cyl, 25)


maxgav13/GMisc documentation built on June 12, 2022, 3:48 a.m.