View source: R/classif_logloss.R
logloss | R Documentation |
Measure to compare true observed labels with predicted probabilities in multiclass classification tasks.
logloss(truth, prob, sample_weights = NULL, eps = 1e-15, ...)
truth |
( |
prob |
( |
sample_weights |
( |
eps |
( |
... |
( |
The Log Loss is defined as
-weighted.mean(log(p), w)
where p is the probability for the true class of observation i.
Performance value as numeric(1)
.
Type: "classif"
Range: [0, Inf)
Minimize: TRUE
Required prediction: prob
Other Classification Measures:
acc()
,
bacc()
,
ce()
,
mauc_aunu()
,
mbrier()
,
zero_one()
set.seed(1) lvls = c("a", "b", "c") truth = factor(sample(lvls, 10, replace = TRUE), levels = lvls) prob = matrix(runif(3 * 10), ncol = 3, dimnames = list(NULL, lvls)) prob = t(apply(prob, 1, function(x) x / sum(x))) logloss(truth, prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.