Exact Learning of Bounded Treewidth Bayesian Networks
Software
This page contains the bestwtree software package discussed in Section 6 of the paper

Learning bounded treewidth Bayesian networksJanne H. Korhonen and Pekka Parviainen. In 16th International Conference on Artificial Intelligence and Statistics (AISTATS 2013), pages 370–378. JMLR, 2013.
The package is available for download under GPL version 3 license. The documentation below is also included in the package.
README best_w_tree is a simple software tool for finding optimal bounded treewidth Bayesian networks. INSTALLATION 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 USAGE To find an optimal network with treewidth 2 for included test data, simply run $ python best_w_tree.py 2 data/test.dat The first parameter defines the treewidth 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 INPUT FORMAT The score file should contain one line per variable. If there are n variables, each line should contain a whitespaceseparated 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,...,n1} 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. LICENSING best_w_tree is distributed under GPL version 3, see the source code.