Negative Log Loss for Binary
Value
A sum of the negative log loss given a vector of predicted
probabilities for outcome == 1 or equivalently a 'success'.
Examples
# summed negative log loss of predicted P(y = 1) against 0/1 outcomes;
# confident-and-right predictions contribute little loss ...
negative_log_loss_for_binary(c(0.9, 0.2, 0.8), c(1, 0, 1))
#> [1] 0.5516476
# ... while a confident-and-wrong prediction is penalized heavily
negative_log_loss_for_binary(c(0.05, 0.2, 0.8), c(1, 0, 1))
#> [1] 3.442019
