Skip to content
ENExplore Calculators

Log Loss Calculator

Calculate logarithmic loss for probabilistic classification predictions.

About Log Loss Calculator

Log loss is the dataset-level average of binary cross-entropy across N samples: LogLoss = (1/N)·Σ[y·ln(p) + (1−y)·ln(1−p)], negated. It's a standard classifier evaluation metric that, unlike accuracy, directly rewards well-calibrated probabilities — a model that confidently predicts the wrong class is penalized far more heavily than one that is uncertain, since ln(p) approaches −∞ as p approaches 0. Log loss is the metric minimized during training of most probabilistic binary classifiers, and is commonly reported for competition leaderboards (e.g. Kaggle) because it evaluates the quality of predicted probabilities, not just the final thresholded class.

Formula

LogLoss = -(1/N) × sum(y_i × ln(p_i) + (1 - y_i) × ln(1 - p_i))

N
Number of samples
y_i
True binary label for sample i
p_i
Predicted probability of class 1 for sample i

Worked example

With the default values below, Log Loss Calculator returns Average Log Loss of 0.267821. Change any input above and every figure here is recalculated in your browser.

Inputs used

True Labels (0/1, comma-separated)
1, 0, 1, 1, 0
Predicted Probabilities (comma-separated)
0.9, 0.2, 0.65, 0.8, 0.3

Results

Average Log Loss
0.267821
Total Loss (Sum)
1.339105
Number of Samples
5
Worst Single-Sample Loss
0.4308

Step by step

  1. 1Per-sample loss: −(y×ln(p) + (1−y)×ln(1−p))= 0.1054, 0.2231, 0.4308, 0.2231, 0.3567
  2. 2Total loss: sum over all samples= 1.339105
  3. 3Average log loss: total loss ÷ N= 0.267821

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 6 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why is log loss preferred over accuracy for evaluating classifiers?

Accuracy only looks at whether the final thresholded prediction was right or wrong, ignoring how confident the model was — log loss directly penalizes overconfident wrong predictions and rewards well-calibrated probability estimates, which matters when probabilities themselves are used downstream (e.g. for ranking or risk scoring).

What is a 'good' log loss value?

It's problem-dependent, but as a reference, a model that always predicts p=0.5 achieves a log loss of ln(2) ≈ 0.693 regardless of the true labels — a well-performing model should score meaningfully below this baseline, with values closer to 0 indicating better calibrated, more confident correct predictions.

How does log loss punish a confident wrong prediction?

If a sample's true label is 1 but the model predicts p=0.01, the loss for that sample is −ln(0.01) ≈ 4.6 — dramatically higher than the ≈0.69 loss from an uncertain p=0.5 prediction, illustrating why log loss discourages overconfidence on samples the model might get wrong.

Log Loss Calculator – Calculate Average Log Loss | Calcrivo