RISO Tutorial

Robert Dodier
robert_dodier@yahoo.com
Last update on or before $Date: 2006/10/18 04:43:28 $

Introduction

RISO is an implementation of distributed belief networks in Java. See the RISO home page for general information, and the Sourceforge project page to download files, submit bug reports, etc. It is assumed that you already have RISO installed. If not, see these installation instructions.

Launching RISO

RISO belief network computations are carried out by a container called the belief network context, which can contain one or more belief networks. Other programs (such as user interface programs) submit data to the belief network context or request some results, but all of the interesting computation is executed by the context.

  1. Tell Java where to look for RISO classes. This command is usually pasted into your .bashrc file, which should be in your home directory.

    export CLASSPATH=/usr/local/riso/classes

  2. Execute the Java RMI registry. This enables Java programs to communicate.

    rmiregistry &

  3. Execute a belief network context. The context is named mycontext in this example. Other programs on the same host computer refer to the context as localhost/mycontext.

    java riso.belief_nets.BeliefNetworkContext -c mycontext

    It's preferable to execute this command in a separate command window; it will produce a lot of debugging output.

Now RISO is running. We will submit a belief network to the context and request computations.

Hello, RISO! example

Loading a belief network into the belief network context

First paste this belief network description into a file, say /tmp/mybn.riso.

riso.belief_nets.BeliefNetwork mybn
{
  riso.belief_nets.Variable X
  {
    type continuous
    distribution riso.distributions.Gaussian
    {
      mean 50
      std-deviation 17
    }
  }
}

Now load that belief network into RISO.

java riso.apps.PublishNetworkString -c localhost/mycontext < /tmp/mybn.riso

Requesting computations via a user interface

Now use a user interface program (RemoteQuery) to communicate with the belief network context. The stuff entered by the user is shown in bold text in this example.

[robert@chromium riso-info]$ java riso.apps.RemoteQuery
Hello, I'll read the stuff you type. See: http://riso.sf.net/bnc-pn-rq.html
> localhost/mybn
RemoteQuery: url: rmi://localhost/mybn
  obtained reference: BeliefNetwork_Stub[UnicastRef [liveRef: [endpoint:[127.0.0.1:21099](remote),objID:[-5e2409bd:10e5408bc2a:-8000, 1]]]]
?
RemoteQuery: context chromium:1099/mycontext; belief network:
riso.belief_nets.BeliefNetwork mybn
{
        % context: chromium:1099/mycontext
        riso.belief_nets.Variable X
        {
                type continuous
                distribution riso.distributions.Gaussian { mean 50.0  std-deviation 17.0 }
        }
}
X ?
RemoteQuery: posterior for chromium/mybn.X, elapsed 0.268 [s]
        riso.distributions.Gaussian { mean 50.0  std-deviation 17.0 }

Explanation of results

The example belief network mybn contains a single variable, X. The input > localhost/mybn causes RemoteQuery to obtain a reference to the belief network. ? causes RemoteQuery to print the description of the belief network. X ? causes RemoteQuery to compute the posterior distribution of X and print it.

Further operations on the belief network

In RemoteQuery, assign a value to X, and compute the posterior distribution.

X = 42
X ?
RemoteQuery: posterior for chromium/mybn.X, elapsed 0.031 [s]
        riso.distributions.GaussianDelta { support-point { 42.0 } }

Now exit RemoteQuery by typing control-D. The belief network mybn is still running in the belief network context. When we restart RemoteQuery, we can see that it still has the same state as when we quit RemoteQuery before.

[robert@chromium robert]$ java riso.apps.RemoteQuery
Hello, I'll read the stuff you type. See: http://riso.sf.net/bnc-pn-rq.html
> localhost/mybn
RemoteQuery: url: rmi://localhost/mybn
  obtained reference: BeliefNetwork_Stub[UnicastRef [liveRef: [endpoint:[127.0.0.1:21099](remote),objID:[-7fc32332:10e59a286b4:-8000, 1]]]]
X ?
RemoteQuery: posterior for chromium/mybn.X, elapsed 0.149 [s]
        riso.distributions.GaussianDelta { support-point { 42.0 } }

Simple sensor model

Now let's consider a belief network model of a sensor. The sensor model comprises three variables: the actual value of the quantity to be measured, the observed sensor reading, and the sensor status. Typically if the sensor is working correctly, the observed value is close to the actual value. But if the sensor is broken, the two may be very different. To keep this example simple, we'll assume a broken sensor reports a fixed, very low value. Much more complex failure models can be constructed.

Here is the description of the belief network. Let's assume this text is pasted into /tmp/simple-sensor.riso.

riso.belief_nets.BeliefNetwork simple-sensor
{
    riso.belief_nets.Variable status
    {
        type discrete { "OK" "not OK" }
        distribution riso.distributions.Discrete
        {
            dimensions { 2 }
            probabilities
            {
                0.99 0.01
            }
        }
    }
    riso.belief_nets.Variable actual
    {
        type continuous
        distribution riso.distributions.Gaussian { mean 50.0  std-deviation 20.0 }
    }
    riso.belief_nets.Variable observed
    {
        type continuous
        parents { status actual }
        distribution riso.distributions.IndexedDistribution
        {
            index-variables { status }
            components
            {
                % component[0]
                riso.distributions.ConditionalGaussian
                {
                    conditional-mean-multiplier { 1.0 }
                    conditional-mean-offset { 0.0 }
                    conditional-variance { 1.0 }
                }
                % component[1]
                riso.distributions.Gaussian { mean -46.0  std-deviation 1.0 }
            }
        }
    }
}

Let's submit this belief network to our belief network context.

java riso.apps.PublishNetworkString -c localhost/mycontext -r < /tmp/simple-sensor.riso

Let's try some computations on this belief network.

Predictive distribution for observed variable

In this scenario, a value is assigned to actual and the posterior distribution for observed is computed. This is a prediction of observed value.



Marginal posterior distribution for actual value

In this scenario, a value is assigned to observed and the posterior distribution for actual is computed.



Marginal posterior distribution for status




RISO home page