The top-level scripts have the following dependency hierarchy:
setup
clean
test
grid_run compare
| | |
| | |
v v |
grid_search |
| | \ |
| | \ |
v v v v
dag tree experiment
| /
| /
v v
learn
Quick explanation of the top-level scripts:
setup.py compile Cython code
clean delete the code generated by Cython
test.py test spnss package
grid_run.py run grid-search in multiple processes (one process per dataset)
grid_search.py train/evaluate DAG-SPN and Tree-SPN models using a grid of hyperparameters
dag.py train a DAG-SPN
tree.py train a Tree-SPN
learn.py various functions used by dag.py and tree.py
experiment.py save/load experiment result files
compare.py analyze/summarize experiment results
The datasets/
directory contains two zip files (gens.domingos.zip and permanent.zip) that
need to be decompressed before running experiments.
To compile the Cython source code, run python setup.py build_ext --inplace
To test the spnss package, run python test.py
Running python NAME --help
(where NAME is grid_search.py, dag.py, or tree.py)
prints out information about the options available when running these scripts.
Running python dag.py nltcs -t 0.01 -cp 10
trains a DAG-structured SPN on the NLTCS dataset using a threshold
of 0.01 and a cluster penalty of 10. On my system this resulted in
the following output:
WARNING:root: ================ 0 ===============
WARNING:root: size: 3439 vld: -6.024147 thresh: 0.010000
nltcs t: 0.01000 cp: 10.0 time:11.1 dag 1288 va: -6.0011 te: -6.0595
It may also print a line reading WARNING:root: ran out of steps to take.
The last line shows the dataset, threshold, cluster-penalty, training time, size of the final SPN, validation likelihood, and test likelihood.
If you use this code for research, please cite:
Dennis, Aaron, and Ventura, Dan. "Greedy structure search for sum-product networks." In Proceedings of the 24th International Joint Conference on Artificial Intelligence. AAAI Press, 2015.
For your convenience, here is a BibTeX entry:
@inproceedings{Dennis2015,
title={Greedy Structure Search for Sum-Product Networks},
author={Dennis, Aaron and Ventura, Dan},
booktitle={Proceedings of the 24th International Joint Conference on Artificial Intelligence},
year={2015},
organization={AAAI Press}
}