Variational Inference for Bayesian Networks Logo
[Sourceforge project page]
John Winn, January 2004
Overview Tutorial Examples Help

Online Help: Importing data and exporting results

VIBES allows for data to be imported from a Matlab file and for results to be saved to another Matlab file. These files are specified in the property panel for a network e.g. in the network below, data is imported from the file MixGaussianData2D.mat and results are saved in the file MixGaussianResults1.mat.

If a full pathname is not given, filenames are taken to be relative to the directory where the network is saved. Don't forget the .mat extension.

Loading data

If a data file is specified, then the data in that file will be loaded whenever the network is loaded or when File -> Load data is selected. The Matlab file must contain:

  • integer values with names corresponding to plates in the network (e.g. d=150)
  • matrices with names corresponding to observed nodes in the network and having the same dimensionality as those nodes including the order of the dimensions. If necessary, you can edit the order of the dimensions of a node by editing the order plates appear in its Plates property.

When a data file is loaded:

  • all existing data is removed,
  • plate sizes are set from corresponding values in the data file,
  • observed data is attached to corresponding nodes and they are marked as observed with a bold outline (like x in the screenshot above).

You can view the observed data for an observed node by double-clicking on it.

Exporting results

If you specify a results filename, then results will be saved to it during inference. Any existing file of that name will be overwritten (including previous results!). As inference proceeds, results are saved every three iterations.

The saved Matlab file contains a matrix for each node in the graph, with the same name as that node. The dimension of the matrix is the dimensionality of the node plus an additional dimension for the size of the parameter vector (which will depend on the distribution). For example for a Gaussian node x of dimensionality 10x5, the saved matrix will be of size 10x5x2. The data corresponds to the expectation of the natural statistic vector of the node under the posterior distribution e.g. for a Gaussian node this is the expectation of [x x^2]. The exception to this is for Gamma and Dirichlet nodes where the natural parameter vector of the posterior distribution is given instead, as this is generally more useful. So for Gamma nodes the vector is [-b' a'-1] where a' and b' are the parameters of the Gamma distribution which is the posterior marginal for that node. For a Dirichlet node it is the vector whose ith element is u_i -1. For more details of natural statistic and natural parameter vectors for exponential family distributions, see the Variational Message Passing publications on my home page.

In addition, the file contains an Nx2 matrix called bound. Each row of the matrix contains the number of the iteration that the bound was calculated at and the value of the bound following that iteration. This format allows for the bound to be calculated intermittantly. The converged lower bound value is therefore given by the Matlab expression bound(size(bound,1),2).