This project aims to compile a structured Bayesian network that is described by a json file to a single PSDD. For example, medium_sf_sdd.json is an example of a json file that describes an SBN. Further, the direcotry medium_sf_sdds contains many sdd files that are referenced from the json file.
mkdir build
cd build
cmake3 ..
make
After running the commands above, two binaries should be generated, structured_bn_main and structured_bn_test. To test the setup, please run
./structured_bn_test
You should see all Passes.
./structured_bn_main --learning_dataset=<path_to_dataset_file> --psdd_filename <output_psdd_filename> --vtree_filename <output_vtree_filename> <sbn_json_file>
This will first learn weights of a SBN structure that is specified by <sbn_json_file>, and compiled the learned SBN into a single PSDD. The compiled PSDD is stored in output_psdd_filename and the used vtree is also stored in output_vtree_filename.
For example, the following command compiles an SBN whose structure is specified by medium_sf_sdd.json. The weights of the SBN is randomly sampled, instead of being learned from a dataset.
./structured_bn_main --sample_parameter --psdd_filename=medium_sf_sdd.psdd --vtree_filename=medium_sf_sdd.vtree medium_sf_sdd.json
The learning dataset is a comma separated file, where the column i represents the value of variable i+1. The index of a variable starts from 1.
For example, the following datafile specifies ten training examples, five of each valid instantiation. One valid instantiation is where variable 1 is 1 and variable 2 is 0. The other valid instantiation is where variable 1 is 0 and variable 2 is 1.
1,0
0,1
0,1
1,0
0,1
1,0
1,0
0,1
1,0
0,1