Skip to content

Latest commit

 

History

History
65 lines (57 loc) · 1.26 KB

README.md

File metadata and controls

65 lines (57 loc) · 1.26 KB

d-separation

CS676/hw1

This is a python implementation of

Koller and Friedman (2009), "Probabilistic Graphical Models: Principles and Techniques" (page 75)

Usage

python d-separation.py -f your_input_file -n1 node1 -n2 node2 -ob given_observations

given_observations should be in the format of 'X1,X2,...'(no space).

Simple Test

Here I use a test case as in

Koller and Friedman (2009), "Probabilistic Graphical Models: Principles and Techniques" (page 76)

The graph looks like below and is described in example.py

For example,

python d-separation.py -f example.txt -n1 1 -n2 4 -ob 3

returns

False

means 1 and 4 are not d-separated given 3

python d-separation.py -f example.txt -n1 1 -n2 4 -ob 2,3

returns

True

means 1 and 4 not d-separated given 2, 3

Running Homework Example

sh run.sh

returns

False
True