Bayesian network Learning and Inference Project
Java Other
Switch branches/tags
Nothing to show
Clone or download
Latest commit 037dc15 Mar 9, 2018
Failed to load latest commit information.
api Fixed Sep 15, 2017
core Fixed Sep 15, 2017
data update May 17, 2017
.gitignore Initial source commit Nov 28, 2016
LICENSE Initial commit Nov 25, 2016 Update Mar 9, 2018 New files added Sep 1, 2017
supplementary-IJAR.pdf m Oct 25, 2017
supplementary-ML17.pdf Supplementary Machine Learning 2017 Feb 2, 2017


Bayesian network Learning and Inference Project


This package implements the algorithms detailed in the following papers:


The process of learning a bounded-treewidth BN is explained by using the "child" network as example.

Dataset format

The format for the initial dataset has to be the same as the file "child-5000.dat", namely a space-separated file containing:

* First line: list of variables names, separated by space;
* Second line: list of variables cardinalities, separated by space;
* Following lines: list of values taken by the variables in each datapoint, separated by space.

Common command line options

  • -d VAL : Datafile path (.dat format)
  • -j VAL : Parent set scores output file (.jkl format)
  • -r VAL : Structure output file (.res format)
  • -t N : Maximum time limit, in seconds (default: 10)
  • -b N : Number of machine cores to use (default: 1)
  • -w N : Maximum treewidth
  • -seed N : Seed for the pseudo random number generator

Parent set identification

The first step is build the parent sets score cache. It can be done with:

java -jar blip.jar scorer.sq -c bdeu -d data/child-5000.dat -j data/child-5000.jkl -n 3 -t 10
  • -a N : (if BDeu is chosen) equivalent sample size parameter (default: 1.0)
  • -c VAL : Chosen score function. Possible choices: BIC, BDeu (default: bic)
  • -n N : Maximum learned in-degree (if 0, no constraint is applied) (default: 0)

Bounded-treewidth structure optimization

For perfoming with k-greedy:

java -jar blip.jar -j data/child-5000.jkl -r data/ -t 10 -w 4 -v 1

For perfoming with the k-greedy enhanched by entropy-based sample ordering:

java -jar blip.jar -smp ent -d data/child-5000.dat -j data/child-5000.jkl -r data/child-5000.kgent.res -t 10 -w 4 -v 1

For perfoming with k-max:

java -jar blip.jar solver.kmax -j data/child-5000.jkl -r data/child-5000.kmax.res -t 10 -w 4 -v 1

Interpreting the result

The format of the ".res" file is as follows: each line indicates the parent set assigned to each variable and its score.

For example the line "4: -2797.39 (10,17,18)" indicates that to the variable with index 4 in the dataset are assgined as parents the variables with index (10,17,18). This parent set has score -2797.39 (by default the score function is the BIC).

Learn the parameters

Using the structure found it is possible to learn the parameters with:

java -jar blip.jar parle -d data/child-5000.dat -r data/child-5000.kmax.res -n data/child-5000.kmax.uai

The final output will be a full Bayesian network in UAI format.