The Gini gain, a measure of set purity usable as a fitness function (FitnessFunction) for decision trees. More...
Static Public Member Functions | |
template<bool UseWeights, typename RowType , typename WeightVecType > | |
static double | Evaluate (const RowType &labels, const size_t numClasses, const WeightVecType &weights) |
Evaluate the Gini impurity on the given set of labels. More... | |
template<bool UseWeights, typename CountType > | |
static double | EvaluatePtr (const CountType *counts, const size_t countLength, const CountType totalCount) |
Evaluate the Gini impurity given a vector of class weight counts. More... | |
static double | Range (const size_t numClasses) |
Return the range of the Gini impurity for the given number of classes. More... | |
The Gini gain, a measure of set purity usable as a fitness function (FitnessFunction) for decision trees.
This is the exact same thing as the well-known Gini impurity, but negated—since the decision tree will be trying to maximize gain (and the Gini impurity would need to be minimized).
Definition at line 27 of file gini_gain.hpp.
|
inlinestatic |
Evaluate the Gini impurity on the given set of labels.
RowType should be an Armadillo vector that holds size_t objects.
Note that it is possible that due to floating-point representation issues, it is possible that the gain returned can be very slightly greater than 0! Thus, if you are checking for a perfect fit, be sure to use 'gain >= 0.0' not 'gain == 0.0'.
labels | Set of labels to evaluate Gini impurity on. |
numClasses | Number of classes in the dataset. |
weights | Weight of labels. |
Definition at line 62 of file gini_gain.hpp.
|
inlinestatic |
Evaluate the Gini impurity given a vector of class weight counts.
Definition at line 34 of file gini_gain.hpp.
|
inlinestatic |
Return the range of the Gini impurity for the given number of classes.
(That is, the difference between the maximum possible value and the minimum possible value.)
numClasses | Number of classes in the dataset. |
Definition at line 203 of file gini_gain.hpp.