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.
RISO can be installed in two ways: (1) either all the RISO classes can be installed on every host, or (2) the classes can be installed on one host, with other hosts obtaining classes automatically through the Java codebase mechanism. Instructions are given for both installation methods. Even if RISO is installed on only one host, a distributed belief network can still be executed; however, all the nodes in the belief network have to be on that one host.It's assumed in these instructions that you have already installed the Java Runtime Environment (JRE) and/or Java Development Kit (JDK). You should be able to find a version of the JRE suitable for your system at java.sun.com.
Instructions are given only for Linux. For installation on other systems, probably the best approach is to install from the jar file (as described below)
(Optional for any installation) Download and unpack the archives containing examples and documentation: riso-20020129.javadoc.tar.gz, riso-20020129.rates.tar.gz, and riso-20020129.web.tar.gz. You don't need those files to complete the following instructions.
To install class files and run applications on one host:
Download the RISO class files. Get the files from the Sourceforge file manager.
Installation from rpm: You want the most recent rpm named "riso-YYYYMMDD-N.noarch.rpm".
rpm -ih riso-YYYYMMDD-N.noarch.rpm
Installation from jar: You want the most recent jar file named "riso-YYYYMMDD.jar". The jar file contains the same files as the rpm.
cd /usr/local; jar xvf riso-YYYYMMDD.jar
(You probably need superuser privileges for that.)
NOTE: The jar file is NOT executable as it stands; you must unpack it.
Set your classpath to point to the RISO classes.
export CLASSPATH=/usr/local/riso/classes
Start the RMI registry.
rmiregistry &
Start a belief network context.
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.
In another command window, load a belief network into the context. First paste a belief network description into a file.
cat << EOF > /tmp/mybn.riso riso.belief_nets.BeliefNetwork mybn { riso.belief_nets.Variable X { type continuous distribution riso.distributions.Gaussian { mean 50 std-deviation 17 } } } EOF
That creates a file named /tmp/mybn.riso. Now load that belief network into RISO.
java riso.apps.PublishNetworkString -c localhost/mycontext < /tmp/mybn.riso
There are other means of loading a belief network into a context. See these notes on using RISO programs.
Now obtain a reference to the loaded belief network and work with it. Here is the belief network equivalent of "Hello, World".
java riso.apps.RemoteQuery > localhost/mybn ? X ?
[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 }
> 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.
See these notes on using RISO programs for more information about how to use RemoteQuery.
There are other RISO applications, and it's easy to write more; all that "RemoteQuery" is doing is to use the RMI registry to obtain a remote reference, and then it's executing method calls using that reference.
In this scenario, you install class files on one host, and load classes automatically from clients using the Java codebase mechanism.
First follow the instructions above for the machine which will host the class files.
Then follow these instructions for each client. (NOTE 2006/10/16: The following did work at one time. However it's probable that the details are out-of-date.)
(On the server) Install the RISO class files where they will be accessible by a web server on the host. For some web servers, a URL such as "http://somehost/~foo" resolves to the directory "/home/foo/public_html". In that case,
cd /home/foo/public_html jar xvf /usr/local/riso/riso.jarwill unpack the files.
You'll need to figure out what works on your server.
(On the server) Start up a web server on the host. For some web servers, it's something like
cd /etc/rc.d/init.d ./httpd startAgain, you'll need to figure out how to do this on your system.
There used to be a simple server distributed with Java, for the express purpose of serving files for RMI; maybe there still is. You might want to look into that.
(On the server) Extract the stub application, RemoteApp.class. This is contained in one class file in riso.jar. Use the command
jar xvf /usr/local/riso/riso.jar riso.general.RemoteApp.classto extract "RemoteApp.class" (on the host). Then copy "RemoteApp.class" to each client.
(On the client) On each client, copy RemoteApp.class into a directory named riso/general. This is the only file that needs to be installed permanently on the client.
(On the client) Execute the RMI registry on each client.
rmiregistry &
(On the client) Create a belief network context using the stub application.
Set environment variables to run the stub application.
export CLASSPATH=riso/general:$CLASSPATH
export RISOHOST=the.class.file.server.something
export JAVALOCATION=~foo/or/something
export CODEBASE="java.rmi.server.codebase=http://$RISOHOST/$JAVALOCATION
IMPORTANT: Don't forget the trailing backslash on the codebase!
Now execute the stub and tell it to execute the context in turn.
java -D$CODEBASE riso.general.RemoteApp -c riso.belief_nets.BeliefNetworkContext -a -c my-context
This will product a lot of debugging information.
For example,
java riso.general.RemoteApp -c riso.general.RegistryPing -a $RISOHOSTtells what belief networks and contexts are running on a particular host.