Learn R Programming

ChemometricsWithR (version 0.1.13)

gini: Gini impurity index for cart objects

Description

A simple implementation of the Gini impurity index for classification and regression trees. Not meant to be called directly - included for demonstration purposes.

Usage

gini(x, class, splitpoint)

Arguments

x

Numeric vector of length n.

class

Class labels, length n.

splitpoint

Tentative split point.

Value

The Gini impurity index, given a certain split point, a vector of possible splits, and a vector of class labels. Lower values indicate more pure leaves.

References

R. Wehrens. "Chemometrics with R - Multivariate Data Analysis in the Natural Sciences and Life Sciences". Springer, Heidelberg, 2011.