gini_weighted: Weighted Gini

Description Usage Arguments Value Examples

View source: R/Evaluation_Functions.R

Description

Calculate the (normalized) weighted Gini index of predictions against the solutions.

Usage

1
2
3
gini_weighted(solutions, predictions, weights = 1)

gini_weighted_normalized(solutions, predictions, weights = 1)

Arguments

solutions

Numerical vector of actual response values.

predictions

Predictions to score against the solution.

weights

Weights to assign to each prediction.

Value

(Normalized) weighted Gini index (numeric scalar).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Create a GLM for testing
## Not run: 
  data(dataCar, package = "insuranceData")
  dataCarGLM <- glm(numclaims ~ veh_value + veh_age + gender + agecat,
                    data = dataCar, family = poisson, offset = log(exposure), x = TRUE)

  gini_weighted(dataCar$numclaims, predict(dataCarGLM, dataCar))

## End(Not run)

## Not run: 
  gini_weighted_normalized(dataCar$numclaims, predict(dataCarGLM, dataCar))

## End(Not run)

KO112/KO documentation built on Oct. 2, 2020, 9:21 a.m.