bayesia logo
BayesiaLab
Expected Log Loss

Expected Log-Loss

Context

The Log-Loss LL(E)LL(E) reflects the number of bits required to encode an n-dimensional piece of evidence (or observation) EE given the current Bayesian network BB. As a shorthand for "the number of bits required to encode," we use the term "cost" in the sense that "more bits required" means computationally "more expensive."

LLB(E)=log2(PB(E)),LL_B(E) = - \log _2\left(P_B(E)\right),

where PB(E)PB(E) is the joint probability of the evidence EE computed by the network BB:

Furthermore, one of the key metrics in Information Theory is Entropy:

H(X)=xXp(x)log2(p(x))H(X) = - \sum\limits_{x \in X} {p(x){{\log }_2}\left( {p(x)} \right)}

As a result, Entropy can be considered the sum of the Expected Log-Loss values of each state xx of variable XX given network BB.

H(X)=xXLLxH(X) = \sum\limits_{x \in X} {L{L_x}}

where

LLx=pB(x)log2(pB(x))L{L_x} = - {p_B}(x){\log _2}\left( {{p_B}(x)} \right)

Usage

To illustrate these concepts, we use the familiar Visit Asia network:

Visit Asia Example
Click to Zoom
Visit Asia Example

Download VisitAsia.xbl (opens in a new tab)

In BayesiaLab, the Expected Log-Loss values can be shown in the context of the Monitors.

Monitors

We consider the nodes Dyspnea\mathit{Dyspnea} and Bronchitis\mathit{Bronchitis} in the VisitAsia.xbl network.

  • On the left, the Monitors of the two nodes show their marginal distributions.
  • On the right, we set P(Bronchities=True)=100%P(\mathit{Bronchities} =\mathrm{True}) = 100\%, which updates the probability of DyspneaDyspnea, i.e., P(Dyspnea=True)=80.54%P(\mathit{Dyspnea} = \mathrm{True}) = 80.54\%.
  • On the Monitor of DyspneaDyspnea, we now select Monitor Context Menu > Show Expected Log-Loss that the Expected Log-Loss values for the states of DyspneaDyspnea are shown instead of their probabilities.
  • This is an interesting example because setting Bronchitis=TrueBronchitis=True does reduce the Entropy of Dyspnea=TrueDyspnea=True, but does not seem to change the Expected Log-Loss of Dyspnea=FalseDyspnea=False.

Illustration

The following plot illustrates H(Dyspnea)H(Dyspnea), LL(Dyspnea=True)LL(Dyspnea=True), and LL(Dyspnea=False)LL(Dyspnea=False). For a compact representation in the plot, we substituted XX for DyspneaDyspnea.

Entropy
Click to Zoom
Entropy

In this binary case, the curves show how the Entropy H(X)Entropy\ H(X) can be decomposed into LL(x=True)LL(x=\mathrm{True}) and LL(x=False)LL(x=\mathrm{False}).

The blue curve also confirms that the Expected Log-Loss values are identical for the two probabilities of Dyspnea=FalseDyspnea=False, i.e., 80.54% and 42.52%.

  • LL(P(Dyspnea=False)=10.1946=0.8054)=0.459LL\big(P(Dyspnea=\mathrm{False})=1-0.1946=0.8054\big)=0.459
  • LL(P(Dyspnea=False)=10.5748=0.4252)=0.459LL\big(P(Dyspnea=\mathrm{False})=1-0.5748=0.4252\big)=0.459

Monitor Tooltip

Instead of replacing the states' probabilities with the Expected Log-Loss values in a Monitor, you can bring up the Expected Log-Loss values ad hoc as a Tooltip.

  • Click on the Information Mode icon in the Toolbar.
  • Then, when you hover over any Monitor with your cursor, a Tooltip shows the Expected Log-Loss values.

Workflow Animation


Copyright © 2025 Bayesia S.A.S., Bayesia USA, LLC, and Bayesia Singapore Pte. Ltd. All Rights Reserved.