Simple file format

The file format simple is used to describe belief networks. Files typically have the ending .simple.

Structure

A file in the simple format starts with the prologue:

network Unknown
f lsb
e <evidence?> <#evidence>
<#variables>

where

The prologue is followed by the variable specifications, one line for each variable, each of the following format:

v <variable> <domainsize> <evidence> <#parents> <name>

if the instance has evidence attached or

v <variable> <domainsize> <#parents> <name>

if there is no evidence (as specified in the prologue), where

The block of variable specifications is followed by the conditional probability distributions for the variable, which consist of two lines for each variable's distribution. The format is as follows:

p <v_0> <v_1> ... <v_n> <v>
<value for 1st tuple> <value for 2nd tuple> ... <value for last tuple>

where <v_0> to <v_n> and <v> signal that the probability distribution P(v | v_0,...,v_n) will be specified in the next line. The <v_i> and <v> are the respective variable's index, as specified earlier in the file. The actual distribution table is then given as the enumeration of probabities for the different tuples in ascending order, starting with the tuple that assigns the first value to each variable's domain (see example below).

Example

Take a simple belief network with three variables X, Y, and Z with domains {0,1}, {0,1}, and {0,1,2}, respectively. Let the joint probability be given by P(X,Y,Z) = P(X) P(Y|X) P(Z|Y).

We assume the following conditional probability tables:

X

P(X)

0

0.436

1

0.564

X

Y

P(Y|X)

0

0

0.128

0

1

0.872

1

0

0.920

1

1

0.080

Y

Z

P(Z|Y)

0

0

0.210

0

1

0.333

0

2

0.457

1

0

0.811

1

1

0.000

1

2

0.189

Given the evidence Y = 1 we could write a file in simple format as follows:

network Unknown
f lsb
e yes 1
3
v 0 2 -1 0 X
v 1 2 1 1 Y
v 2 3 -1 1 Z
p 0
0.436 0.564
p 0 1
0.128 0.872 0.920 0.080
p 1 2
0.210 0.333 0.457 0.811 0.000 0.189

Conversion from other formats

To convert problems from the common XBIF format to the simple format, you can use this Python script. A description of the XBIF format is available here.

Simple_file_format (last edited 2008-03-10 19:07:37 by localhost)