MetricsWeighted (version 0.3.0)

gini_coefficient: Gini Coefficient

Description

Calculates weighted Gini coefficient, obtained as 2 * AUC - 1. Up to ties in predicted equivalent to Somer's D. The larger the Gini coefficient, the better.

Usage

gini_coefficient(actual, predicted, w = NULL, ...)

Arguments

actual

Observed values (0 or 1).

predicted

Predicted values of any value (not necessarly between 0 and 1).

w

Optional case weights.

...

Further arguments passed to AUC.

Value

A numeric vector of length one.

See Also

AUC.

Examples

Run this code
# NOT RUN {
gini_coefficient(c(0, 0, 1, 1), 2 * c(0.1, 0.1, 0.9, 0.8))
gini_coefficient(c(0, 0, 1, 1), c(0.1, 0.6, 0.9, 0.5))
gini_coefficient(c(0, 0, 1, 1), c(0.1, 0.6, 0.9, 0.5), w = 1:4)
# }

Run the code above in your browser using DataCamp Workspace