Skip to Content

Tree

Current Tree tab selected in the Node Editor

Context

In Bayesian networks, Conditional Probability Distributions (CPDs) are typically represented by Conditional Probability Tables (CPTs), which contain one probability distribution for each combination of the states of the parents. Moreover, in BayesiaLab, the Conditional Probability Distributions (CPDs) are ultimately always represented internally as Conditional Probability Tables (CPTs). However, for defining the CPDs, it can be very helpful to employ a deterministic approach (see the Deterministic tab) or to use formulas (see the Formula tab).

Conditional Probability Trees

Additionally, BayesiaLab offers Conditional Probability Trees (CPTr) for representing CPDs by exploiting Contextual Independencies. A Contextual Independence exists if the state of one parent makes the co-parent or co-parents independent of the child.

Example

To explain the benefit of using Trees, we adapt our popular example “Where is my bag?” from Chapter 4 in our e-book: Once again, the problem domain is air travel. And, again, we wish to infer the probability of receiving our luggage at the final destination of our journey. As opposed to the original model, we now consider two flight segments. So, there is a risk of our bag not making it onto the first flight, and then there is the risk that our bag doesn’t get loaded onto the connecting flight, i.e., our second flight segment. Needless to say, our bag needs to be on both flights to make it to the destination. Once at the destination airport, it is just a matter of time until we see the bag on the luggage carousel in the baggage claim area.

Loading SVG...

In the original example, we encoded the problem directly in a CPT. Now that we have two flights to consider, the CPT would have twice as many cells to fill, 88 to be precise. Thus, we are looking to simplify the way we encode this domain by leveraging Contextual Independencies. It is easy to see, for instance, that it doesn’t matter how long we wait at the baggage carousel if the bag didn’t even make it on either the first or the second flight. Therefore, we don’t need to speculate about the probabilities of the bag appearing as a function of time. If the bag wasn’t on the first flight, Bag on Carousel\mathit{Bag\ on\ Carousel} is entirely independent of Time\mathit{Time}. Only if the bag made it onto both flights do we need to think about these probabilities. Using Trees, we directly encode this in the following workflow.

Workflow

  • Open Node Contextual Menu > Edit for Bag on Carousel\mathit{Bag\ on\ Carousel}.
  • Select Probability Distribution > Tree in the Node Editor.
  • Your starting point is a blank panel that only features the states True\mathrm{True} and False\mathrm{False} for the node Bag on Carousel\mathit{Bag\ on\ Carousel}.
Blank Tree editor before selecting a parent
  • Now, if Bag on First Flight\mathit{Bag\ on\ First\ Flight} is False\mathrm{False}, Bag on Carousel\mathit{Bag\ on\ Carousel} is always False\mathrm{False}. We don’t even need to consider Bag on Second Flight\mathit{Bag\ on\ Second\ Flight} or Time\mathit{Time}.
  • Right-click on No Selector and then pick Bag on First Flight\mathit{Bag\ on\ First\ Flight} from the drop-down menu.
  • Set that False\mathrm{False} leaf’s False\mathrm{False} and True\mathrm{True} probabilities to 100 and 0, respectively.
Loading SVG...
  • Next, right-click on the row True\mathrm{True} and select Bag on Second Flight\mathit{Bag\ on\ Second\ Flight} from the drop-down menu.
  • If Bag on Second Flight\mathit{Bag\ on\ Second\ Flight} is False\mathrm{False}, Bag on Carousel\mathit{Bag\ on\ Carousel} is always False\mathrm{False}.
  • Set that False\mathrm{False} leaf’s False\mathrm{False} and True\mathrm{True} probabilities to 100 and 0, respectively.
Loading SVG...
  • When both flight states are True\mathrm{True}, Bag on Carousel\mathit{Bag\ on\ Carousel} depends on Time\mathit{Time}.
  • So, right-click on the row True\mathrm{True} and select Time\mathit{Time} from the drop-down menu.
  • Following the rationale introduced in Chapter 4, we assign the probabilities for each state of Time\mathit{Time} in the True\mathrm{True} column, starting with 0 and increasing by 10 percentage points for each step. Set the corresponding False\mathrm{False} probabilities to 100 minus the True\mathrm{True} probabilities, so each leaf sums to 100%.
Loading SVG...
  • To conclude, click Validate. The CPTr is complete, and it fully describes the CPD of the node Bag on Carousel\mathit{Bag\ on\ Carousel}.
  • It is important to know that while we defined the CPD with a CPTr, BayesiaLab still stores it as a CPT. In that sense, the CPTr was a convenient shorthand for us.
  • The simplification of our input as a CPTr becomes clear once we juxtapose the following, corresponding CPT:
Loading SVG...

Workflow animation