A Bayesian Network Framework

1. Introduction

Bayesline is Bayesian Network Framework (a very good tutorial on Bayesian networks can be found here), allowing users and developers to create Bayesian networks as well as specialized types knowledge to be assigned to the nodes of the network. It is based on the valuation concept and inference algorithm of Shenoy and Shafer.

The novelty of the Bayesline approach lies in the possibility to define new types of values for nodes and new types of relations between nodes, apart from the commonly used Gaussians, conditional tables etc. One example is shown in the following picture. There you have a node A representing an image, another node B representing a set of connected foreground components and a node C representing a connected foreground component prototype.

[example graph goes here]

2. Variables, Clusters and Valuations

The four main components within a Bayesline Bayesian Network are Bayesian networks, variables, clusters and valuations. Variables are the nodes in Bayesian Networks, clusters are sets of those variables and valuations are representing (probabilistic) knowledge about variables and clusters. A typical valuation for a Variable would be a one-dimensional Gaussian, and a typical valuation for a cluster of n variables would be a n-dimensional Gaussian, or a conditional table for n-1 condition variables and one consequence variable. A Bayesian Network in this sense is the structure that contains all variables, clusters and valuations. The following code snippet shows how this four components are used in the bayesline framework. Two variables are created, one is 'valuated' with the Boolean value "true", and the cluster of A and: B is valuated with a conditional table, meaning that if A is true, B is true with a probaility of 0.2, and if A is false with a probability of 0.7. (the RCPtr template is a reference counting pointer to valuations). Note that the direction of conditional knowledge is given by how variables are ordered within the cluster. Also note that the concept of cluster does not imply direction of knowledge, thus allowing undirectional arcs between variables (as in Gaussians).

BayesianNetwork b;

Variable* v1 = b.createVariable("A");
Variable* v2 = b.createVariable("B");
v1->assign(new Bool(true));

Cluster* c1 = b.createCluster();
RCPtr<ConditionalTable> ct = new ConditionalTable();
ct->addRule(new Bool(true), new Sum(true,0.2));
ct->addRule(new Bool(false),new Sum(true,0.7));

Clusters and variables are the nodes in a secondary graph structure called Join Tree that needs to be constructed for the Shenoy-Shafer Inference Algorithm. Within this algorithm valuations get combined with other valuations and marginalized to specific indices. Combination of two valuations means aggregation of knowledge. In the case of Gaussians (and generally for probability potentials) this is a pointwise multiplication of both Gaussian functions. Marginalization means subsuming information for n-k variables for a valuation over n variables, i.e. a cluster.  

So for the Shenoy Shafer Inference Algorithm to work in generic way, one needs to define an interface for valuations which is to be implement for different kinds of knowledge about variables and clusters. This interface is the the Valuation class in "bayesline/core/Valuation.h" and looks like this:

class Valuation {
    virtual RCPtr<Valuation> combineImpl(RCPtr<Valuation> v) = 0;
    virtual RCPtr<Valuation> marginalize(const Indices& indices) = 0;

3. GUI

Another benefit of having dedicated objects for knowledge/valuations is the possibility of having dedicated means to visualize and edit this knowledge. Every knowledge designer can write his valuation class and the corresponding visualization class to extend the system. You can write special procedures to display a certain kind of knowledge in the network graph, e.g. a conditional table for two variables as a directed arc or a one dimensional Gaussian as node with a symbolic curve in it, and procedures for a detailed view and edition of knowledge, e.g. a table editor for conditional tables. This also allows different visualizations for cluster knowledge as opposed to only arcs: color schemes, ellipses around all cluster members, etc.

4. The Project

The Project is meant to explore the possibilities that lie in Bayesian Networks. After all there should be a framework and GUI that allows to create complete applications by defining a Bayesian Network. The focus right now is on image understanding, but a lot other (##) domains seem feasible, too.

Its results are published under the LGPL. The project work is managed on a sourceforge account at http://sourceforge.net/projects/bayesline/. If you have any requests or want to participate in some sense please feel free to contact bayesline@users.sourceforge.net and/or fill out a request form at the mentioned sourceforge page. 

5. Links


last time edited on 11.03.2003


Counter provided by WebCounter

SourceForge.net Logo