Learn R Programming

ModelMetrics (version 1.2.2.2)

logLoss: Log Loss

Description

Calculates the log loss or entropy loss for a binary outcome

Usage

logLoss(...)

# S3 method for default logLoss(actual, predicted, distribution = "binomial", ...)

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

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

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

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

# S3 method for 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

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab