Skip to Content

Expected Log-Loss

Context

The Log-Loss LLB(E)\mathrm{LL}_B(E) reflects the number of bits required to encode an nn-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)=−log⁡2(PB(E)),\mathrm{LL}_B(E) = - \log _2\left(P_B(E)\right),

where PB(E)P_B(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)=−∑x∈Xp(x)log⁡2(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)=∑x∈XLLxH(X) = \sum\limits_{x \in X} {\mathrm{LL}_x}

where

LLx=−pB(x)log⁡2(pB(x))\mathrm{LL}_x = - {p_B}(x){\log _2}\left( {{p_B}(x)} \right)

Usage

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

Loading SVG...
VisitAsia.xbl
XBL

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(Bronchitis=True)=100%P(\mathit{Bronchitis}=\mathrm{True}) = 100\%, which updates the probability of Dyspnea\mathit{Dyspnea}, i.e., P(Dyspnea=True)=80.54%P(\mathit{Dyspnea}=\mathrm{True}) = 80.54\%.
Loading SVG...
  • On the Monitor of Dyspnea\mathit{Dyspnea}, we now select Monitor Contextual Menu > Show Expected Log-Loss so that the Expected Log-Loss values for the states of Dyspnea\mathit{Dyspnea} are shown instead of their probabilities.
  • Setting Bronchitis=True\mathit{Bronchitis}=\mathrm{True} reduces the entropy of Dyspnea\mathit{Dyspnea}. The contribution from True\mathrm{True} decreases, while the contribution from False\mathrm{False} changes only slightly.
Loading SVG...

Illustration

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

Loading SVG...

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

The blue curve shows the contribution from False\mathrm{False}. Its probability falls from 57.48% to 19.46%. Both Monitor values display as 0.459 bits. Calculating with the displayed probabilities gives about 0.4592 and 0.4595 bits, respectively.

The red curve shows the contribution from True\mathrm{True}. Its probability rises from 42.52% to 80.54%, and its contribution falls from about 0.525 to 0.251 bits.

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.
Loading SVG...

Workflow animation