sklearn.metrics.log_loss — scikit-learn 0.20.4 documentation (original) (raw)

y_true : array-like or label indicator matrix

Ground truth (correct) labels for n_samples samples.

y_pred : array-like of float, shape = (n_samples, n_classes) or (n_samples,)

Predicted probabilities, as returned by a classifier’s predict_proba method. If y_pred.shape = (n_samples,)the probabilities provided are assumed to be that of the positive class. The labels in y_pred are assumed to be ordered alphabetically, as done bypreprocessing.LabelBinarizer.

eps : float

Log loss is undefined for p=0 or p=1, so probabilities are clipped to max(eps, min(1 - eps, p)).

normalize : bool, optional (default=True)

If true, return the mean loss per sample. Otherwise, return the sum of the per-sample losses.

sample_weight : array-like of shape = [n_samples], optional

Sample weights.

labels : array-like, optional (default=None)

If not provided, labels will be inferred from y_true. If labelsis None and y_pred has shape (n_samples,) the labels are assumed to be binary and are inferred from y_true. .. versionadded:: 0.18