log_loss

probly.metrics.log_loss(y_prob: object, y_true: object) → object[source]

Compute the mean log loss of the predictions, the average of log_loss_per_instance().

No clipping is applied, so the mean is inf if any true class has probability zero.

Parameters:
  • y_prob – Predicted class probabilities of shape (..., K), or a categorical distribution.

  • y_true – Integer class labels of shape (...), or target probabilities of shape (..., K).

Returns:

The mean log loss.

Raises:
  • ValueError – If y_true has neither shape or its labels are not integers.

  • TypeError – If y_prob is a sample of predictions.