logLoss: Log Loss

Description Usage Arguments Examples

View source: R/logLoss.R

Description

Calculates the log loss or entropy loss for a binary outcome

Usage

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

## Default S3 method:
logLoss(actual, predicted, distribution = "binomial", ...)

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

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

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

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

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

Arguments

...

additional parameters to be passed the the s3 methods

actual

a binary vector of the labels

predicted

a vector of predicted values

distribution

the distribution of the loss function needed binomial, poisson

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')

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

JackStat/ModelMetrics documentation built on Nov. 7, 2018, 5:19 a.m.