Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Logloss

Logarithmic loss


Description

Defined as: -mean(log(p_i)), where p_i is the predicted probability of the true class of observation i. Inspired by https://www.kaggle.com/wiki/MultiClassLogLoss.

Usage

Logloss(probabilities, truth)

Arguments

probabilities

[numeric] vector (or matrix with column names of the classes) of predicted probabilities

truth

vector of true values

Examples

n = 20
set.seed(122)
truth = as.factor(sample(c(1,2,3), n, replace = TRUE))
probabilities = matrix(runif(60), 20, 3)
probabilities = probabilities/rowSums(probabilities)
colnames(probabilities) = c(1,2,3)
Logloss(probabilities, truth)

measures

Performance Measures for Statistical Learning

v0.3
GPL-3
Authors
Philipp Probst [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.