next up previous
Next: 2 Examples Up: Elvira Specification Format Previous: Elvira Specification Format

Subsections

1 Elvira Specification Format

The Elvira specification format allows to represent different kind of networks in a file (normally with extension .elv). These networks are related with the treatment of uncertainty in artificial intelligence. It can represent a general Network, Bayesian network, an Influence Diagram. In general, a network will contain a set of nodes, a set of links and a set of relations among the nodes. Nodes can have a finite number of possible states or they can have a continuous domain. Each relation express normally numerical information for a set of nodes of the network, but it is possible to have a relation without any numerical information. Numerical information can be represented in different ways. For example, by means of a table, a tree, a function, etc. A relation can be representing a conditional probability distribution, a convex set of conditional probabilities, an utility function in an Influence Diagram, etc.

An elvira file (see production rule Elvira) has two parts:

Within the body of the network there are four basic parts in an elvira file.

  1. Network description: This section contains general information about the network and the other sections.
  2. Nodes description: It contains properties for each one of the nodes of the network.
  3. Links description: It contains properties for each one of the link of the network.
  4. Relations description: It contains properties for each one of the relations of the network.

As an example of the elvira format we can see a file containing a Bayesian network:

bnet  Asia { 
	title="Red bayesiana para el diagnostico de cancer metastasico";
	comment="Es el ejemplo mas famoso de red bayesiana";
	author="Greg Cooper";
	whochanged="Equipo Proyecto Elvira";
	whenchanged="22/04/98";
	default node states=(ausente presente);

node Cancer {
	title="Cancer metastasico";
	comment="Indica si se da la enfermedad o no"; 
 }
node Calcio {
	title="Elevacion del calcio serico";
	states=(normal elevado);
 }
node Tumor {
	title="Tumor cerebral";
         states = (presente ausente);
 }
node Coma;
node Jaquecas;

link Cancer Calcio;   
link Cancer Tumor; 
link Calcio Coma; 
link Tumor Coma; 
link Tumor Jaquecas; 

relation A { 
comment = "Prevalencia del cancer metastasico";
kind-of-relation=conditional-prob;
values= table (0.2 0.8 );
}
relation B A { 
values= table (0.8 0.2 0.2 0.8 );
}
relation C A { 
values= table (0.05 0.2 0.95 0.8 );
}
relation E B C { 
comment = "Tanto la elevacion del calcio serico como el tumor
			cerebral pueden producir coma";
values= table(0.2 0.95 0.2 0.2 0.8 0.05 0.8 0.8);
}
relation D C { 
values= table (0.8 0.6 0.2 0.4 );
}
}


1.1 Network description

The Network section contains all the information about the network. The other three sections are included as part of this section as Element Declarations. Besides element declarations, a network can contain properties and default declarations. Production rule NetworkContent describes the following elements within a network:


1.2 Nodes description

The Nodes section contains (see production rule NodeDeclaration) information for each one of the nodes of the network. We can have the following type of nodes in an elvira file: Production rule NodeDeclaration express that declaration of a node contains the reserved word node followed by the name of the node and a declaration that determines the type of node we have. This last declaration can be one of the following three:

A node can contain a set of properties that describes it. The properties common to all type of nodes are the following (see production rule NodeProperty):

When we declare a node in an elvira file, then all its properties are initialized with his default value. There are two default nodes, the default finite states node and the default continuous node. See next sections to know the values of the properties of these default nodes.

1.2.1 Finite states nodes

The body of the declaration of a finite states node (production FiniteBody) contains the set of properties we want to change with respect to the default finite states node. Among these properties there are general properties and specific finite states properties. General properties have been described in previous section sub:nodes (see production rule NodeProperty).

Production rule FiniteBody tell us that the body of a finite states node can contain a set of finite node properties (FiniteNodeProperties). Finite states node properties (FiniteNodeProperties) are defined by production rule FiniteNodeProperties. This last production tell us that a finite states property can be a general node property (described in previous section) or a specific finite states property (see production rule FiniteProperty). Specific finite states properties are the following:

The states of a node can be defined as in the following examples:

When we use a decimal number for the name of one state, then this name must be enclosed with quotes when used in a relation. For example, in the next example the names of states must be enclosed with quotes in the relation:

node A(finite-states) {
   states = (1 3); 
}
relation A {
   values = table (
            ["1"]= 0.3;
            ["3"]= 0.7;
            );
}
If you do not use quotes for the names of states in the relation then you could define an erroneous relation. In a relation, a decimal number $n$ without quotes means the state number $n$ for that node begining with $0$. For example, previous relation could be defined, too:
node A(finite-states) {
   states = (1 3); 
}
relation A {
   values = table (
            [0]= 0.3;
            [1]= 0.7;
            );
}

The order in which we specify the states of a finite states node can be important to specify the values of a relation for the node with a TableDeclaration. This is so when a value in such relation is specified whithout specifing the state of the node. For example:

node Calcio{
 states = (low hight);
}
relation Calcio{
  values=table (0.3 0.7);
}

Previous declaration does not defined the same relation as the following:

node Calcio{
 states = (hight low);
}
relation Calcio{
  values=table (0.3 0.7);
}

See production rule TableDeclaration for details.

Initially, the default finite states node takes the following values for its properties:

The value of one property of the default finite states node can be changed using a default declaration (see section 1.1).

1.2.2 Continuous nodes

The body of the declaration of a continuous node (production ContinuousBody) contains the set of properties we want to change with respect to the default continuous node. Among these properties there are general properties and specific continuous properties. General properties have been described in section 1.2 (see production rule NodeProperty).

Production rule ContinuousBody tell us that the body of a continuous node can contain a set of continuous node properties (ContinuousNodeProperties). Continous node properties (ContinuousNodeProperties) are defined by production rule ContinuousNodeProperties. This last production tell us that a continuous property can be a general node property (described in section 1.2) or a specific continuous property ((see production rule ContinuousProperty). Specific continuous properties are the following:

Initially, the default continuous node takes the following values for its properties:

The value of one property of the default continuous node can be changed using a default declaration (see section 1.1).


1.3 Links description

The Links section contains information for each one of the links among nodes of the network. A link join two of the nodes of the network. We have two kinds of links:

Production rule LinkDeclaration express that the declaration of a link begins with the reserved work link, followed by the name of the two nodes this link joins. Optionally we can have a set of properties (see production rule LinkProperties) describing the link.

Currently elvira format allows the following link properties (see LinkProperty):

When a new link is found in an elvira file, it takes the value of its properties from the default link unless the property is explicitly changed in the definition of the link. Default link takes the following values for its properties:

For example a declaration of an undirected link between the nodes Calcio and Cancer could be:

link Calcio Cancer{
   directed=true
}

The value of one property of the default link can be changed using a default declaration (see section 1.1).


1.4 Relations description

The Relations section contains information for each one of the relations of the network. A Relation relates several nodes of the network and generally have attached numerical information represented by means of a potential. This numerical information is described with property value (see bellow). A potential can represent a conditional probability distribution, an a priori probability distribution, a convex set of probabilities, an utility function, a density function for a continuous variable, etc. Potentials can be represented by means of tables, trees and functions.

Production rule RelationDeclaration express that a relation begins with the reserved word relation followed by the name of the nodes this relation relates. Optionally a set of properties can be attached to the relation (see production rule RelationProperties).

Currently elvira format accepts the following relation properties (see production rule RelationProperty):

When a new relation is found in an elvira file, it takes the value for its properties from the default relation unless the property is explicitly changed in the definition of the link. Default relation takes the following values for its properties:

The property kind-of-relation express the kind of relation. Currently we have the following kinds of relations:

1.5 Representation of numerical information in relations

As we have seen, property value describes numerical information in the relation. Let see the different ways this numerical information can be represented:


1.5.1 Tables: TableDeclaration

This representation associates a float number to each configuration of a set of finite states variables. A TableDeclaration begins with the reserved word table and can take two formats (see TableDeclaration):

1.5.2 Discrete probability trees: TreeDeclaration

This representation allows saving space when specify numerical information for a relation with finite states variables. A discrete probability tree is a directed labeled tree, where each internal node represents a finite states variable an each leaf node represents a probability value. Each internal node will have as many outgoing arcs as possible values the variable it represents has. Each leaf of the tree contains a float number. Discrete probability trees are able to efficiently represent regularities in potentials, to obtain compact representations. See figure 1 as an example.

Figure 1: Conditional distribution represented with a probability tree
\begin{figure}\centerline{
\psfig{file=arbol2.eps,width=3.5in}}\end{figure}

A TreeDeclaration begins with the reserved word tree. Next we put reserved word case and the name of the desired root variable, or a numerical value (in this case all configurations take this numerical value). Within the body of case we specify the different cases the root variable can take. It is possible also to use DefaultAssignment as in tables (TableDeclaration). Probability tree in figure 1 will appear in an elvira file as:

relation Coma Calcio Tumor { 
        values=tree (
           case  Coma{
                  presente=case  Calcio{ 
                             elevado=0.7;
                             normal=case  Tumor{
                                      presente=0.8;
                                      ausente=0.05;
                             } 
                  } 
                  ausente=case  Calcio{ 
                            elevado=0.3;
                            normal=case  Tumor{
                                     presente=0.2;
                                     ausente=0.95;
                            }
                  }
          }
       );
}

1.5.3 Convex set of probabilities: ConvexSetDeclaration

This representation is used when want to define a convex set of probabilities with a finite set of extreme points for a set of finite states variables. Each extreme point is represented in elvira format using a table declaration (TableDeclaration).

A convex set (see production ConvexSetDeclaration) begins with the reserved work convex-set followed be a finite set of TableDeclaration. For example, next declaration defines a convex set with two extreme points:

relation Cancer {   
   values=convex-set(
             table (0.2 0.8)
             table (0.3 0.7)
          );
}

Every table declaration (TableDeclaration) can take one of the two formats described in section 1.5.1. For example next declaration defines also a convex set with two extreme points:

relation ErrLowOutput {
values=convex-set(
          table (
             [True] = 0.05,
             [False] = 0.95,
          )
          table (
             [True] = 0.08,
             [False] = 0.92,
          ) 
      );
}

1.5.4 Functions: FunctionDeclaration

This representation allows to associate numerical values to each configuration of a set of finite states variables, using a function of the finite states variables. For example next relation is a simple definition of function in this way:

relation n1 n2 n3 {
   values = function Normal( 0.7, 0.2);
}
Previous definition express that value for a given configuration of variables n1 n2 n3 is obtained with the function Normal, the two parameters (0.7 and 0.2 in this case) and the configuration of variables n1 n2 n3.

Arguments of a function can be float numbers and other relations. When a relation is argument of a function in another relation, then it must be defined as non active (active=false). Also, it is neccesary to give an unanimous identifier (with property name-of-relation) to the argument relation when is defined. For example, next definitions represent a relation (relation n1 n2 n3) with a relation (relation n1 n2) as an argument:

relation n1 n2{
   active = false;
   name-of-relation = name1;
   values = table { 0.2, 0.8, 0.3, 0.7}
}

relation n1 n2 n3{
   values = function OneFunction(0.3, 0.8, name1);
}

In this case the numerical value for a given configuration of variables of the relation is got evaluating in first place the argument relations. When we evaluate an argument relation for the given configuration of variables, we obtain a float number. Once we evaluate all argument relations then main relation can be evaluate obtaining again a float number.

Available functions are:

1.5.5 Continuous probability trees: ContinuousTreeDeclaration

Continuous probability trees are used to represent numerical information (density functions) for a set of finite states and continuous variables. This representation is able to represent a set of functions with the shape of linear combination of exponential functions of linear functions. That is, these trees are able to represent functions with the following form:
\begin{displaymath}
f(X_1,X_2,X_3) = 0.3 e^{-0.2 X_1 + 0.4 X_2} + 0.7 e^{0.4 X_2 + 0.3 X_3} + 0.4
\end{displaymath} (1)

where $X_1$ , $X_2$ and $X_3$ are continuous variables.

It is possible to have different functions depending on the values of some of the variables. For example, a function with only continuous variables could be:

\begin{displaymath}
f(X_1,X_2,X_3) = \left\{
\begin{array}{ll}
0.3 \cdot e^{-0....
...+ 0.1 & \mbox{if} \;\;
5 \leq X_1 \leq 10
\end{array}\right.
\end{displaymath} (2)

where $X_1$ , $X_2$ and $X_3$ are continuous variables.

Another example where we have continuous and finite states variables could be:


\begin{displaymath}
f(X_1,X_2,X_3,X_4) = \left\{
\begin{array}{ll}
\left\{
\be...
...1 X_3} + 0.1 & \mbox{if} \;\; X_4=\mbox{no}
\end{array}\right.
\end{displaymath} (3)

where $X_1$ , $X_2$ and $X_3$ are continuous variables, and $X_4$ is a finite states variable.

A continuous probability tree is a tree where internal nodes can be labeled with finite states variables or continuous variables and leaf nodes are labeled with functions of the shape described in previous examples. Behaviour of internal nodes labeled with finite states variables is completly the same as in discrete probability trees (TreeDeclaration) (the node will have as many outgoing arcs as possible values the variable it represents has). Nodes labeled with a continuous variable will have as many outgoing arcs as discretization intervals we want to use for this continuous variable. For example, function in formula 2 is represented with the continuous probability tree of figure 2.

Figure 2: An example of continuous probability tree
\begin{figure}\begin{center}
\input{arbolcont.eepic}
\end{center}
\end{figure}

As another example, function in formula 3 is represented with the continuous probability tree in figure 3

Figure 3: Example of continuous probability tree with continuous and finite states variables
\begin{figure}\begin{center}
\input{arbol2cont.eepic}
\end{center}
\end{figure}

A ContinuousTreeDeclaration begins with the reserved word continuous-tree, followed by the body (BodyContinuousTree) of the continuous tree. The body can take two shapes:

Continuous probability tree of figure 2 (formula 2) will be represented in an elvira file with the following relation:

relation X1 X2 X3{
values= continuous-tree (
          case X1(0.0,5.0,10.0) {
            0=0.3 * exp(-0.2 X1 + 0.4 X2) + 
              0.7 * exp(0.4 X2 + 0.3 X3) + 0.4;
            1=0.4 * exp(-0.3 X1 + 0.3 X2) + 
              0.6 * exp(0.7 X2 + 0.1 X3) + 0.1;
          }
);
}

Continuous probability tree of figure 3 (formula 3) will be defined with the following relation in an elvira file:

relation X1 X2 X3 X4{ 
values= continuous-tree (
   case X4{
      yes=case X1(0.0,5.0,10.0) {
            0=0.3 * exp(-0.2 X1 + 0.4 X2) + 0.4;
            1=0.4 * exp(-0.3 X1 + 0.3 X2) + 0.1;
          }
      no=0.6 * exp{0.7 X2 + 0.1 X3} + 0.1
   }
);
}


next up previous
Next: 2 Examples Up: Elvira Specification Format Previous: Elvira Specification Format
Andrés Cano 2001-03-01