Description Usage Arguments Value Examples
View source: R/Evaluation_Functions.R
Calculate the (normalized) weighted Gini index of predictions against the solutions.
1 2 3 | gini_weighted(solutions, predictions, weights = 1)
gini_weighted_normalized(solutions, predictions, weights = 1)
|
solutions |
Numerical vector of actual response values. |
predictions |
Predictions to score against the solution. |
weights |
Weights to assign to each prediction. |
(Normalized) weighted Gini index (numeric scalar).
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.