log_loss_per_instance

probly.metrics.log_loss_per_instance = <flextype.singledispatch.Flexdispatch object>

Compute the log loss -log(p_y) of each prediction.

No clipping is applied, so the loss is inf where the true class has probability zero.

Parameters:
  • y_prob – Predicted class probabilities of shape (..., K), or a categorical distribution, whose log probabilities are used directly so that logit-parameterized distributions stay exact.

  • y_true – Integer class labels of shape (...), or target probabilities of shape (..., K) (array or categorical distribution) under which the expected loss is taken.

Returns:

The loss of each prediction, of shape (...).

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

  • TypeError – If y_prob is a sample of predictions.