binary_log_loss#

scikitplot.corpus.binary_log_loss(y_true, y_prob)[source]#

Mean negative log-likelihood of binary outcomes under the probabilities.

Parameters:
y_truearray-like of shape (n_samples,)

Binary relevance labels.

y_probarray-like of shape (n_samples,)

Predicted probabilities of relevance.

Returns:
float

Non-negative; lower is better.

Raises:
ValueError, TypeError

See reliability_table.

Parameters:
Return type:

float

Notes

User. A probability of exactly 0 or 1 is clipped to [eps, 1 - eps] (float64 machine epsilon) so one confident mistake gives a large finite loss rather than infinity; this is the clipping scikit-learn applies.

Examples

>>> round(binary_log_loss([1, 0], [0.8, 0.3]), 6)
0.289909