2UBayes Version 0.1

(preliminar)

Software for approximate inference in binary credal networks


Thanks for the visit; you're visitor (counter) since November 20 2005.
Last up date: November 20 2005.


Introduction

Graphical models associated with probabilities are used in many fields. Bayesian networks are the most popular probabilistic graphical model in the literature. In situations where we have lack of data, incomplete beliefs and divergence between expert opinions, uncertainty can be represented by sets of probability measures called credal sets. Such sets, when associated with directed acyclic graphs, result in credal networks. Inference algorithms in credal networks generally display high complexity, and approximate inference seems to be a natural solution for large networks. In my PhD thesis I have presented three new approximate algorithms for inference in binary credal networks: Loopy 2U (L2U), Iterated Partial Evaluation (IPE) and Structured Variational 2U (SV2U). The first one, the L2U algorithm, is an extension of the Loopy Belief Propagation algorithm for Bayesian network inference. The second one, the IPE algorithm, is directly based on the Localized Partial Evaluation (LPE) technique. Finally, the SV2U algorithm implements a variational approach; I have shown how to formulate mean field approximations for credal sets using naive (fully factorized) and structured (tree-like) schemes.

These algorithms are implemented in a free software package called 2UBayes that is available from this page.

Technical References

Downloading 2UBayes

To run 2UBayes you just have to download the library 2UBayes.jar.

You probabily want some network samples to test the software. You can download a zipped file containing many samples used in the publications: networkExamples.zip .

Running 2UBayes

2UBayes is coded in the Java language; to run it, you need to have the Java Virtual Machine installed. We have coded BNGenerator using Java 1.4. Download Java 1.4 or later from JavaSoft if you don't have it yet. You should know that the IPE algorithm is not working yet with observations (it works only for marginal inferences).

1) 2UBayes is run as follows  (assuming network files and the 2UBayes.jar are in the same directory):

>> java -classpath .;2UBayes.jar embayes.Embayes

You will see a console like this:

C:\ji_soft\2UBayes\dist>C:\j2sdk1.4.2_04\bin\java -classpath C:\j2sdk1.4.2_04\lib\*.jar;
C:\ji_soft\2UBayes\dist\2UBayes.jar embayes.EmBayes

EmBayes Console (for Bayesian networks)
Commands (brackets indicate several values):
h -> This help message.
l "name" -> Load a network.
o "variable" -> Set variable as not observed.
o "variable" "value" -> Observe variable.
r -> Generate a random number of observations.
t { "variable" } -> Set variables as explanatory.
u { "variable" } -> Set variables as non-explanatory.
i { "variable" } -> Posterior marginal for variables.
e "variable" -> Expected value for variable.
m -> Maximum a posteriori for explanatory variables.
p filename -> Parameter learning (updating) using data in filename
s -> Crash test for computation of marginal.
d { "variables" } -> Posterior marginal using Loopy BP.
*********************************************************
2UBayes Console (for credal networks)
a -> Load a binary credalnetwork (you need the Lowe.xml and Upper.xml).
Windows (networks must be in the same directory of EmBayes.class)
Linux (you must set the path in the code at Line 213 and 218)
c "queriedVariable" "label" -> L2U(multiconnected)/2U(polytree) posterior marginals.
You have to enter with a label(name) for the simulation.
(2 files will be generated with the results - L2U simulation stop when it converge)
b "variable" -> Set variable as not observed.
b "variable" "value" -> Observe variable.
v "label" "option"-> SV2U posterior marginal. You have to enter with a label(name) for the simulation.
You have to set (random or order) polytree generation method.
(File containing the results is generated)
f "queriedVariable" "nIteration" -> IPE posterior marginals.
You have to enter with number of iteration for the simulation.
(File containing the results is generated with network name and nIteration)
g "name"-> Save the credal network loaded in JavaBayes BIF format.
q -> Quit.
 

2) Now you have to load a network (command option "a"):

>> a dog-problem

After this, you will see in your console:

Insert command character (l|o|t|u|i|m|e|x|a|q) or (b|c|d|f|g|q):
>>a dog-problem
Parsed command: a
load XMLBIF .xml file ...
load variables ...
---nodename : light_on
---node position : 75.0 ,223.0
---nodename : bowel_problem
---node position : 438.0 ,82.0
---nodename : dog_out
---node position : 305.0 ,172.0
---nodename : hear_bark
---node position : 323.0 ,308.0
---nodename : family_out
---node position : 163.0 ,73.0
load ProbabilityDistributions ...
load XMLBIF .xml file ...
load variables ...
---nodename : light_on
---node position : 75.0 ,223.0
---nodename : bowel_problem
---node position : 438.0 ,82.0
---nodename : dog_out
---node position : 305.0 ,172.0
---nodename : hear_bark
---node position : 323.0 ,308.0
---nodename : family_out
---node position : 163.0 ,73.0
load ProbabilityDistributions ...
 

2UBayes loads 2 binary Bayesian network in ".xml" format, equivalent to 1 binary credal network . One Bayesian network contains the lower probabilities of P(X_i=x_i|pa_i), where X_i is a categorical variable of the network. The other one contains the upper probabilities. Note that binary credal network can be specified by intervals. For example, in the dog-problem network, we have the file "dog-problemLower.xml" containing the values: P(f)=0.15, P(b)=0.01, P(l|f)=0.8, P(l|\neg f)=0.01, etc. Then, to load a binary credal network in 2UBayes you need 2 files (Bayesian networks): "(name)Lower.xml" and "(name)Upper.xml". This procedure allows to construct a network in any Bayesian network package that saves in xml format.

3) Once loaded the networks, you can make inferecens using the algorithms: L2U, IPE and SV2U. Also you can set your observations before executing the inference algorithms. The execution of the algorithm L2U in hte dog-problem network is illustrated as follows (a text file containing the results will be generated):

Insert command character (l|o|t|u|i|m|e|x|a|q) or (b|c|d|f|g|q):
>>c dog-out teste
Parsed command: c
Invalid variable names!
Insert command character (l|o|t|u|i|m|e|x|a|q) or (b|c|d|f|g|q):
>>c dog_out teste
Parsed command: c

********** Minimum and maximum BEL values by L2U propagation *********

P(light_on)=[0.405 0.5]
P(bowel_problem)=[0.01 0.05]
P(dog_out)=[0.616375 0.756375]
P(hear_bark)=[0.305 0.375]
P(family_out)=[0.15 0.25]
**End of Iteration:0

********** Minimum and maximum BEL values by L2U propagation *********

P(light_on)=[0.1285 0.30000000000000004]
P(bowel_problem)=[0.01 0.05]
P(dog_out)=[0.616375 0.756375]
P(hear_bark)=[0.37366125 0.54164375]
P(family_out)=[0.15 0.25]
**End of Iteration:1

********** Minimum and maximum BEL values by L2U propagation *********

P(light_on)=[0.1285 0.30000000000000004]
P(bowel_problem)=[0.01 0.05]
P(dog_out)=[0.616375 0.756375]
P(hear_bark)=[0.37366125 0.54164375]
P(family_out)=[0.15 0.25]
**End of Iteration:2
Process time: 265 milliseconds.
Results saved as result_L2U_dog-problem_teste.txt

Acknowledgments

We thank Denise Drapper and Marco Zaffalon for providing their thesis. We thank Alessandro Antonucci for working with us for some period.

This research was conducted at the Decision Making Lab at the University of Sao Paulo , with support from the funding agency FAPESP ; both institutions are in Sao Paulo, Brazil.