Skip to main content

Modelling With Bayes Nets

Bayes networks are a good way to model multiple interacting states. A single Bayes formula will tell you about how two variables co-occur. A Bayes network is like using multiple Bayes formulas to see how many variables interact.

Materials​

Activity​

Each variable represents a state that we can measure and predict and is recorded as a column header. Familiarize yourself with each step.

Draw the setup​

Draw a picture of the following: Your lawn has a sprinker system on it. You can see the record of whether the sprinkler went off on your sprinkler system. You also have a little weathervane with a rain gauge and a sunlight sensor. For your COGS 300 project, you put an Arduino with a moisture sensor in the grass. You set up a Bayes net to predict each variable from each other variable: Cloudy, Sprinkler, Rain, WetGrass.

Make the Bayes Net​

Going to online.bayesserver.com, open the Sprinkler example, and/or draw your own causal model. Which variables are causal? Which are not? Put the causal variables higher in the network.

Variables​

Make sense of each variable on its own by drawing a picture that corresponds to the True and False setting of that variable. For example: Cloudy = T means that it was cloudy outside. Cloudy = F means that it was sunny (not cloudy) outside. Finish this for each variable.

Cross the variables​

Just like above, make sense of multiple variables being set at once. Think about your causal model and differentiate co-occurences from causalities. For example, Rain = T; WetGrass = T implies that the rain caused the grass to be wet, but Rain = F; WetGrass = T implies that something else caused the grass to be wet. Finish making sense of the full cross of variables by drawing examples.

Experimental setup​

Decide with your group how you will run an experiment to get the data to create the distribution from the online example(examples of raw data and priors below).

Raw data sample​

This table represents the raw data you would collect if you were running this experiment.

CloudySprinklerRainWetGrass
TFTT
FTFT
TFTT
FFFF
FTFT
TFFF
TFTT
FFTT
FTTT
TTTT
FFFF
TFTF
FTFT
TFTT
FTFF
TFTT
FFFF
TFFF
FFTT
FTFT
TFTT
FTTT
TFTT
FFFF
TTFT
FTFT
TFTT
FFTT
TFTT
FFFF
FTFT
TFTT
TFTF
FTFT
FFFF
TFFF
FTTT
TFTT
FTFT
TTTT
FFFF
TFTT
FFTF
FTFT
TFTT
FFFF
TFFF
FTFT
TFTT
FFFF
TFTT
FTFT
TFTF
FFTT
TFTT
FTFT
FFFF
TFFF
FTTT
TFTT
FTFT
TFTT
FFFF
TFTT
FTFT
FFTT
TTTT
TFFF
FTFT
TFTT
FFFF
TFTF
FTFT
TFTT
FFFF
FTFT
TFTT
FFTT
FTFT
TFFF
TFTT
FTFT
FFFF
TFTT
FTTT
TFTT
FFFF
FTFT
TFTT
FFTT
TFFF
FTFT
TFTT
FFFF
TFTT
FTFT
TFTT
FFFF
TFTT
FTFT

Distribution​

This table represents a possible probability distribtion you would build from the prior distribution (note that it is not exact, just an illustration).

CloudySprinklerRainWetGrassProbability
TTTT0.0396
TTTF0.0004
TTFT0.0090
TTFF0.0010
TFTT0.3240
TFTF0.0360
TFFT0.0000
TFFF0.0900
FTTT0.0495
FTTF0.0005
FTFT0.1800
FTFF0.0200
FFTT0.0450
FFTF0.0050
FFFT0.0000
FFFF0.2000