Learn R Programming

MetricsWeighted (version 0.5.4)

logLoss: Log Loss/Binary Cross Entropy

Description

Calculates weighted logloss resp. cross entropy. Equals half of the unit Bernoulli deviance. The smaller, the better.

Usage

logLoss(actual, predicted, w = NULL, ...)

Value

A numeric vector of length one.

Arguments

actual

Observed values (0 or 1).

predicted

Predicted values strictly larger than 0 and smaller than 1.

w

Optional case weights.

...

Further arguments passed to weighted_mean.

See Also

deviance_bernoulli.

Examples

Run this code
logLoss(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8))
logLoss(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8), w = 1:4)

Run the code above in your browser using DataLab