Description Usage Arguments Details Value Examples
View source: R/modelling_misc.R
Normalized Gini score for binary outcome modelling
1 | gini_norm(actual, predictions)
|
actual |
Actual outcome |
predictions |
Predicted outcome |
Based on https://www.kaggle.com/wiki/RCodeForGini
Normalized Gini score
1 2 3 4 5 6 7 8 | df <- data.frame(
actual = c(1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0),
predicted = seq(1, 0, length.out = 40)
)
gini_val <- gini_norm(df[, 'actual'], df[, 'predicted'])
## Compare to AUC from pROC package
# AUC_val <- pROC::roc(df[, 'actual'], df[, 'predicted'])$auc
# gini_val == 2 * AUC_val - 1
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.