gini: GINI Coefficient

Description Usage Arguments Examples

View source: R/gini.R

Description

Calculates the GINI coefficient for a binary classifcation model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
gini(...)

## Default S3 method:
gini(actual, predicted, ...)

## S3 method for class 'glm'
gini(modelObject, ...)

## S3 method for class 'randomForest'
gini(modelObject, ...)

## S3 method for class 'glmerMod'
gini(modelObject, ...)

## S3 method for class 'gbm'
gini(modelObject, ...)

## S3 method for class 'rpart'
gini(modelObject, ...)

Arguments

...

additional parameters to be passed the the s3 methods

actual

A vector of the labels. Can be numeric, character, or factor

predicted

A vector of predicted values

modelObject

the model object. Currently supported glm, randomForest, glmerMod, gbm

Examples

1
2
3
4
5
6
7
data(testDF)
glmModel <- glm(y ~ ., data = testDF, family="binomial")
Preds <- predict(glmModel, type = 'response')

gini(testDF$y, Preds)
# using s3 method for glm
gini(glmModel)

ModelMetrics documentation built on March 26, 2020, 7:48 p.m.