Log Loss

Perda logarítmica = -[y·log(p) + (1-y)·log(1-p)].
Created by
Renato Passos, Eng. de Software
Reviewed by
Renato Passos, Eng. de Software

Last updated: Apr 18, 2026

Log Loss
0,1054

Formula

LL = -[y·log(p)+(1-y)·log(1-p)]

About this calculator

Log Loss is a machine learning metric to evaluate probabilistic predictions in binary classification tasks. It heavily penalizes confident yet incorrect predictions. The formula calculates the discrepancy between the true label (y) and predicted probability (p), weighting errors via logarithms. Lower values indicate better models, as they show closer alignment between predictions and reality.

It works as a mathematical 'cost': when predictions match reality (y=1 and p≈1, or y=0 and p≈0), the cost is minimal. In opposite cases (e.g., y=1 but p≈0), the cost spikes, forcing the model to avoid overconfidence. It's ideal for scenarios like medical diagnostics, where misplaced trust can be critical.

When using Log Loss, be cautious with imbalanced datasets. In cases of unequal classes, the metric may be biased. It's not recommended for multi-class classification without adjustments. It's common to pair it with other metrics like accuracy and AUC for a more comprehensive performance assessment.

Frequently asked questions

Why does Log Loss penalize extreme predictions?

Because confident yet incorrect predictions (e.g., 99% for the wrong class) create massive logarithmic variations, drastically increasing loss. This encourages models to stay calibrated.

How to interpret Log Loss values?

Values close to 0 indicate well-calibrated models. Higher values mean worse predictions. There's no universal threshold, but comparing models is more useful than absolute values.

Can I use Log Loss for multi-class problems?

Yes, but it needs adjustment (e.g., categorical Log Loss). The original formula is modified to include all possible classes in the calculation.

What happens if predicted probability is 0 or 1?

The logarithm of 0 is undefined, and of 1 is zero. Models avoid extreme predictions to prevent infinite values. Adding small epsilon values (e.g., 1e-15) prevents numerical errors.

Other ML Metrics calculators