bayesia logo

Tree

ProbabilityDistributionTree

Context

In Bayesian networks, Conditional Probability Distributions (CPD) are typically represented by Conditional Probability Tables (CPT), which contain one probability distribution for each combination of the states of the parents. Moreover, in BayesiaLab, the Conditional Probability Distributions (CPD) are ultimately always represented internally as Conditional Probability Tables (CPT). 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 CPD 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.

Bag

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 is entirely independent of Time. Only if the bag made it on the first and the second flight, we need to think about these probabilities. Using Trees, we directly encode this in the following workflow.

Workflow

  • Open the Node Editor for the node Bag on Carousel.
  • Select the Tree tab.
  • Your starting point is a blank panel, which only features the states True and False for the node Bag on Carousel.
BagBlankTree
  • Now, if Bag on First Flight=False, Bag on Carousel is always False. We don't even need to consider Bag on Second Flight or Time.
  • Right-click on No Selector and then pick Bag on First Flight from the drop-down menu.
  • Click on the row False and then enter 100 into the False column.
BagFirstFlightFalse
  • Next, click on the row True and select Bag on Second Flight from the drop-down menu.
  • If Bag on Second Flight=False, Bag on Carousel is always False.
  • Click on the row False and then enter 100 into the False column.
BagSecondFlightFalse
  • Only if both are True, Bag on Carousel becomes dependent on Time.
  • So, click on the row True and select Time from the drop-down menu.
  • Following the rationale introduced in Chapter 4, we assign the probabilities for each state of Time in the True column, starting with 0 and increasing by 10% for each step.
BagTime
  • To conclude, click Validate. The CPTr is completed, and it fully describes the CPD of the node 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:
BagCPT

Workflow Animation


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