Exact Learning of Bounded Tree-width Bayesian Networks


This page contains the best-w-tree software package discussed in Section 6 of the paper

The package is available for download under GPL version 3 license. The documentation below is also included in the package.

best_w_tree is a simple software tool for finding optimal bounded tree-width Bayesian networks.                    
To use this software, you will need to have Python 2.7 and Cython (http://www.cython.org) installed. The you can compile the software by running
$ python setup.py build_ext --inplace
To find an optimal network with tree-width 2 for included test data, simply run
$ python best_w_tree.py 2 data/test.dat
The first parameter defines the tree-width bound and the second is the input file.
To run the software with the scores obtained from Adult and Housing data sets of UCI Machine Learning Repository (http://archive.ics.uci.edu/ml), try the following commands
$ python best_w_tree.py -n 10 -z 2 data/housing.dat
$ python best_w_tree.py -n 10 -z 2 data/adult.dat
The option -n limits the number of included variables and -z tells the program to treat score value "0.0" in the input files as minus infinity.
For a full list of options, run
$ python best_w_tree.py --help
The score file should contain one line per variable. If there are n variables, each line should contain a whitespace-separated list of 2^n values. The j:th value on line i is interpreted as the local score f_i(J), where J is the set obtained by selecting all elements x in {0,1,2,...,n-1} such that the bit x is 1 in j. For example, 
106 = 1101010 = { 1, 3, 5, 6}
Note that there is a degree of redundancy here; entries with i:th bit set are required on line i, but they will never be used by the software, as i cannot be in its own parent set.
Any "-" in the input is interpreted as minus infinity, as is "0.0", if the option -z is given to the software.


best_w_tree is distributed under GPL version 3, see the source code.