Formula: Brier Score & Log Loss Formula
- predictedProbabilityP: Predicted Probability P (p)
- actualOutcome0or1: Actual Outcome0or1 (0 or 1)
- historicalBaseRateClimo: Historical Base Rate Climo (base rate)
Compute Brier Score, Brier Skill Score (BSS), and Binary Cross-Entropy Log Loss (nats & bits).
Whatever the outcome, a forecast of 0.5 is exactly 0.5 away from it, and 0.5 squared is 0.25. That makes 0.25 a useful line in the sand. A model whose mean Brier score is above 0.25 on a balanced problem is doing worse than refusing to take a view. On rare events the bar is lower, because always forecasting the low base rate already scores well.
Yes, and the page shows it. With p at 0.82 and an outcome of 0, the skill score is minus 9.758 against a base rate of 0.25. A negative value means the model did worse than simply forecasting the base rate every time. There is no lower limit on a single case, which is another reason to compute the skill score from averages over many forecasts.
The page refuses it and asks for an outcome of exactly 0 or 1. The Brier score and log loss here are for binary events only. If your target is a share or a soft label, the squared error still makes sense mathematically, and so does cross-entropy with a fractional target, but you will need to work those cases out by hand or in code with the same formulas.
Brier cannot go above 1, but log loss has no upper limit. At p of 0.05 with an outcome of 1, Brier is 0.9025 and log loss is 2.996 nats. At 0.0001 log loss reaches 9.21 nats while Brier barely moves. Log loss is designed to hit confident errors hard, so a few of them can dominate the average.
Set the outcome to 0. The page then uses the probability the model gave to the non-event, which is 1 minus p. A forecast of 0.1 for something that did not happen has a loss of minus ln 0.9, or 0.105 nats, and a Brier score of 0.01. The same forecast for an event that did happen would score far worse.
Most code does, because a probability of exactly 0 or 1 makes the log undefined when the forecast is wrong. This page does not clip: it rejects 0 and 1 and accepts anything strictly between, so 0.0001 is allowed and gives 9.21 nats on a miss. Libraries pick different clip levels, which changes the worst-case loss. Use the same clipping for every model you compare.
They are the same measurement in different units, so neither is better. Bits are nats divided by ln 2, about 0.693. The default case shows 0.1985 nats and 0.2863 bits for the same forecast. Only compare figures that use the same base, and convert one of them if a paper and your code disagree.
Use the share of positive outcomes in a reference period or in the training data, whichever is the fair comparison for your decision. For weather that is the long-run frequency of rain on that kind of day. If you change the base rate, only the skill score changes. The Brier score and both log loss lines stay the same.
Not by itself. A low mean Brier score can come from strong resolution, meaning the model separates events from non-events well, even if its stated probabilities run a little high or low. To judge calibration, bin forecasts by predicted probability and compare each bin's average forecast with how often the event occurred in that bin.
Yes, for a single yes or no outcome they are the same formula: minus the log of the probability the model gave to what actually happened. Deep learning frameworks call it binary cross-entropy when it is used as a training loss, and evaluation reports tend to call it log loss. The default case gives 0.1985 nats under either name.
The model gave only 0.1 to what actually happened. Log loss is minus ln 0.1, which is 2.3026 nats, and Brier is 0.9 squared, or 0.81. Against a base rate of 0.25 the skill score is minus 11.96. A single miss like this can outweigh several well-judged hits in an average, especially on log loss.
The default case is one forecast. A model said there was an 82% chance of the event, and the event happened, so the outcome is 1. The base rate for comparison is 0.25, meaning the event happens about a quarter of the time in the historical record.
The Brier score is the squared gap between the forecast and what happened. Here that is (0.82 minus 1) squared, which is 0.18 squared, or 0.0324. The result card rounds it to 0.032. Zero would be a perfect forecast and 1 is the worst possible, a forecast of 0 for something that happened or 1 for something that did not.
Log loss asks a different question: how surprised should the model be? It takes the natural log of the probability the model gave to the outcome that actually occurred, and flips the sign. The model gave 0.82 to the event, so the loss is minus ln 0.82, which is 0.1985 nats. Divide by ln 2 and the same figure becomes 0.2863 bits. The card shows these as 0.199 nats and 0.286 bits.
The skill score of 0.942 compares the model with a lazy forecaster who always says 0.25. That forecaster would have scored (0.25 minus 1) squared, or 0.5625, on this case. The model's 0.0324 is a small fraction of that, so the skill score sits close to 1.
Both scores reward a forecast that leans the right way, but they punish mistakes very differently. Brier grows with the square of the miss. Log loss grows with the logarithm of how little probability you gave the truth, and that has no ceiling.
Run the page with p at 0.5 and the outcome at 1. Brier comes out at 0.25 and log loss at 0.693 nats, which is exactly 1 bit. A coin-flip forecast costs one bit whatever happens. That is a handy benchmark: a model whose average log loss in bits is above 1 is doing worse than saying 50% every time.
Now make the forecast confidently wrong. With p at 0.05 and an outcome of 1, Brier rises to 0.9025 and log loss to 2.996 nats. Push p down to 0.0001 and Brier is about 0.9998, barely worse, while log loss jumps to 9.21 nats. A forecast of exactly 0 is refused, because the log of zero has no value. The Brier score has almost run out of room. Log loss keeps climbing because a forecaster who rules something out entirely and then sees it happen deserves to be told so.
The practical upshot is that one or two overconfident misses can dominate an average log loss and hardly move an average Brier score. Neither behaviour is wrong. They measure different things, and it helps to know which you are reading before you compare two models.
The page scores a single forecast. In practice you have a list of them, and the Brier score for the list is the mean of the squared gaps. Log loss for the list is the mean of the per-case losses. Nothing else changes, so you can use the page one row at a time and average the results.
Take four forecasts. Forecast A said 0.82 and the event happened. B said 0.3 and it did not. C said 0.1 and it did not. D said 0.5 and it did. The squared gaps are 0.0324, 0.09, 0.01 and 0.25. They add to 0.3824, and dividing by four gives a mean Brier score of 0.0956.
For log loss, the case that did not happen uses the probability of the other outcome. B gave 0.7 to the non-event, so its loss is minus ln 0.7, or 0.3567 nats. C gave 0.9 to the non-event, a loss of 0.1054. A is 0.1985 and D is 0.6931. The four add to 1.3537, so the mean log loss is about 0.338 nats.
Checking one row on the page before trusting a script is a good habit. If your code reports a different figure for a single row, look for a probability that is stored as a percentage, an outcome coded as something other than 0 and 1, or a log taken in base 10.
The third input only affects one line, the Brier skill score. The page computes the Brier score a forecaster would get by always predicting the base rate, then reports 1 minus the model's Brier divided by that reference. A positive figure beats the base rate, zero ties it, and a negative figure loses to it.
Set p to 0.25 with an outcome of 1 and the skill score is exactly 0. The model has said nothing the base rate did not already say. Set p to 0.82 with an outcome of 0 and the skill score falls to minus 9.758. The model put most of its weight on an event that did not happen, while the reference forecaster only put a quarter there and scored 0.0625.
That swing is why a skill score on one case is not very meaningful. With a set of forecasts, the usual approach is to compute the mean Brier score for the model and the mean Brier score for the base-rate forecast over the same cases, then take 1 minus their ratio. For the four forecasts above with a base rate of 0.25, the reference scores are 0.5625 twice and 0.0625 twice, a mean of 0.3125. The model's 0.0956 gives a skill score of about 0.69, a far steadier figure than any single row.
The preset comparisons bracket the default with two other forecasts. In the first, the model hedged at 0.55 and the event happened. Brier is 0.2025, shown as 0.203, log loss is 0.5978 nats or 0.8625 bits, and the skill score is 0.64. Being right with little conviction still beats the base rate, but only by a modest margin.
In the second, the model said 0.9 and the event did not happen. Brier jumps to 0.81 and log loss to 2.3026 nats, which is 3.3219 bits. The skill score falls to minus 11.96, because a forecaster who always said 0.25 would have scored only 0.0625 on this case. One confident miss costs about four times what the hedge cost, on either score.
The page checks its inputs before scoring. The forecast and the base rate must both lie strictly between 0 and 1, and the outcome must be exactly 0 or 1. Anything else returns an error instead of a number. The most common trigger is typing 82 instead of 0.82; the message asks for decimals. A probability of exactly 0 or 1 is refused too, since a wrong forecast at either extreme would have infinite log loss.
The two log loss lines carry the same information in different units. Nats use the natural logarithm. Bits use base 2. To move between them, divide nats by ln 2, about 0.6931, which is why the default shows 0.1985 nats and 0.2863 bits.
Machine learning code usually reports binary cross-entropy with the natural log, so compare a training log against the nats line. Information theory texts and some forecasting papers prefer bits, because one bit has an easy meaning: the surprise of a fair coin landing on the side you were told was 50% likely.
If someone quotes a log loss and does not say the base, assume natural log, then check by running a single known case. A forecast of 0.5 should give 0.693 in nats and exactly 1 in bits. A figure of 0.301 would mean base 10, which is rare but turns up in spreadsheets.
A model is well calibrated when its 70% forecasts come true about 70% of the time, its 20% forecasts about 20% of the time, and so on. You cannot see that from one row. A single forecast of 0.82 that came true is consistent with a perfectly calibrated model and with one that says 0.82 for everything.
To check calibration, group the forecasts into bands such as 0 to 0.1, 0.1 to 0.2 and upward, then compare the average forecast in each band with the share of events that actually happened. Plotted, this is a reliability diagram. Points near the diagonal mean the probabilities can be taken at face value.
The mean Brier score over a set can be split into three parts: reliability, which is the calibration error; resolution, which rewards forecasts that differ from the base rate when they should; and uncertainty, which depends only on how often the event occurs. A low Brier score can come from good resolution with mediocre calibration, so a team that needs to act on the stated probability should look at the reliability part directly rather than the total.
If the decision will rest on rare, costly events, log loss is the stricter judge, because it punishes a model that says 0.01 for something that then happens. That is often what you want for fraud flags, medical alerts or failure prediction. Expect it to be noisy on small samples, where one miss can move the average a long way.
If the forecasts will be read by people, Brier is easier to explain. It stays between 0 and 1, it has the same units as a squared probability, and a 0.25 always means the same as a coin flip. Weather services have long used it for rain forecasts for that reason.
Whichever you choose, compare models on the same cases, the same base rate and the same log base. A model trained to minimise log loss may not have the best Brier score, and the reverse is also true, so report both if the choice is not settled. This page is useful for spot checks on individual rows. A full evaluation needs the averages over the whole test set and a look at calibration by band.