Building a Belief Network


This notebook helps to construct a belief network visually. You can export the belief network and run query algorithms on it afterwards. You can create new variables and edges, remove existing ones, and change the names and factors of variables.

You can run each cell by selecting it and pressing Ctrl+Enter in Windows or Shift+Return in MacOS. Alternatively, you can click the Play button in the toolbar, to the left of the stop button. For more information, check out our AISpace2 Tutorial.

Feel free to modify our codes either in this notebook or somewhere outside (e.g. python files in /aipython/). If you want to modify our codes outside, you might find this helpful for how your changes can take effect.

You need to run the following command to import our pre-defined problems.

In [ ]:
# Run this to import pre-defined problems
from aipython.probGraphicalModels import bn_empty, bn_simple1, bn_simple2, bn_simple3, bn_grass_watering, bn_fire_alarm, bn_diagnosis, bn_diagnosis_extended, bn_conditional_independence, bn_car_starting, bn_electrical_diagnosis, bn_hailfinder

In [ ]:
from aispace2.jupyter.bayes import BayesBuilder

builder = BayesBuilder(bn_simple3)

# Visualization options
# For more explanation please visit:
builder.text_size = 13 # The fontsize of the text
builder.line_width = 2.0 # The thickness of edges

Obtaining the Belief Network

The following method enerates the Python code that, once run, constructs a Belief_Network.

In [ ]:

In [ ]: