Calculate logloss or cross-entropy for a set of predictions.
logloss(prediction, outcome, tol = .Machine$double.neg.eps)
prediction | A vector of estimated probabilities. |
---|---|
outcome | A vector of observed outcomes. |
tol | Numerical tolerance. Can also be used to threshold errors for really bad predictions, or when you don't want a model to be penalized too strongly in the presence of high dispersion. Default is .Machine$double.neg.eps. |
a numeric vector
#> [1] 0.2817529# Thresholding large errors for bad predictions preds <- c(0.000001) outcomes <- c(1) logloss(preds, outcomes)#> [1] 13.81551logloss(preds, outcomes, 0.01)#> [1] 4.60517