javaslam.tjt
Class ThinJunctionTree.Contraction

java.lang.Object
  |
  +--javaslam.tjt.ThinJunctionTree.Contraction
Enclosing class:
ThinJunctionTree

public class ThinJunctionTree.Contraction
extends Object

Represents a variable contraction of a variable v along an edge e = Ci -> Cj. If this contraction is executed, then the v is marginalized out of the cluster Cj and also from the separator potential of e. If there are other edges emanating from Cj that carry v, then v is first (recursively) contracted along these edges. This operation preserves the singly-connected and running-intersection properties (as well as consistency), but violates the potential property. Thus, it results in a junction tree that is valid for some graphical model, but not that of the original junction tree.


Field Summary
protected  List descendants
          If not null, this is a list of ThinJunctionTree.Contractions that must first be executed before this contraction can be executed.
 JunctionTree.JTEdge e
          The edge along which the variable is to be contracted.
protected  double err
          The approximation error induced by this contraction.
 Variable v
          The variable to contracted.
 
Constructor Summary
ThinJunctionTree.Contraction(JunctionTree.JTEdge e, Variable v)
          Constructor.
ThinJunctionTree.Contraction(JunctionTree.JTEdge e, Variable v, boolean local)
          Constructor.
ThinJunctionTree.Contraction(JunctionTree.JTEdge e, Variable v, boolean local, double error)
          Constructor.
 
Method Summary
 double computeError()
          Computes the approximation error introduced by a variable contraction along an edge e = Ci -> Cj.
 boolean equals(Object o)
          Returns true if this and the supplied object are equal.
 double error()
          Returns the approximation error that will result if this contraction is executed, which is the relative entropy (or Kullback-Lieblier divergence) from the original distribution to the resulting distribution.
 void execute()
          Executes the edge contraction.
 int hashCode()
          Returns the hash code of this edge contraction.
protected  void initialize(JunctionTree.JTEdge e, Variable v, boolean local)
          Initializer.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

v

public Variable v
The variable to contracted.


e

public JunctionTree.JTEdge e
The edge along which the variable is to be contracted.


descendants

protected List descendants
If not null, this is a list of ThinJunctionTree.Contractions that must first be executed before this contraction can be executed.


err

protected double err
The approximation error induced by this contraction.

Constructor Detail

ThinJunctionTree.Contraction

public ThinJunctionTree.Contraction(JunctionTree.JTEdge e,
                                    Variable v,
                                    boolean local)
Constructor.

Parameters:
e - an edge in the junction tree
v - a variable contained in the cluster to which e is directed
local - if true, then this contraction assumes that the cluster to which e is directed is a leaf in the subtree induced by v and does not perform any recursive contractions
Throws:
IllegalArgumentException - if either of the clusters incident to e do not contain v

ThinJunctionTree.Contraction

public ThinJunctionTree.Contraction(JunctionTree.JTEdge e,
                                    Variable v)
Constructor.

Parameters:
e - an edge in the junction tree
v - a variable contained in the cluster to which e is directed
Throws:
IllegalArgumentException - if either of the clusters incident to e do not contain v

ThinJunctionTree.Contraction

public ThinJunctionTree.Contraction(JunctionTree.JTEdge e,
                                    Variable v,
                                    boolean local,
                                    double error)
Constructor.

Parameters:
e - an edge in the junction tree
v - a variable contained in the cluster to which e is directed
local - if true, then this contraction assumes that the cluster to which e is directed is a leaf in the subtree induced by v and does not perform any recursive contractions
error - the error of this contraction
Throws:
IllegalArgumentException - if either of the clusters incident to e do not contain v
Method Detail

initialize

protected void initialize(JunctionTree.JTEdge e,
                          Variable v,
                          boolean local)
Initializer.

Parameters:
e - an edge in the junction tree
v - a variable contained in the cluster to which e is directed
local - if true, then this contraction assumes that the cluster to which e is directed is a leaf in the subtree induced by v and does not perform any recursive contractions
Throws:
IllegalArgumentException - if either of the clusters incident to e do not contain v

error

public double error()
Returns the approximation error that will result if this contraction is executed, which is the relative entropy (or Kullback-Lieblier divergence) from the original distribution to the resulting distribution.

Returns:
the approximation error that will result if this contraction is executed

execute

public void execute()
Executes the edge contraction.


computeError

public double computeError()
Computes the approximation error introduced by a variable contraction along an edge e = Ci -> Cj. This approximation error is the Kullback-Liebler divergence from the original junction tree's distribution to the distribution that would result if execute() were called.

If the terminus Cj is a leaf of the subtree induced by v, then the approximation error is the conditional mutual information I(Cj - S; v | S) where S is the separator of e. If Cj is not a leaf of the subtree induced by v, then the approximation error is the sum of the contraction errors of v along all edges Cj -> Ck (except Cj -> Ci).

Returns:
the Kullback-Liebler divergence from the original junction tree's distribution to the distribution that would result if execute() were called

equals

public boolean equals(Object o)
Returns true if this and the supplied object are equal. Two edge contractions are equal if their edges and variables are the same.

Overrides:
equals in class Object
Returns:
true if this and the supplied object are equal

hashCode

public int hashCode()
Returns the hash code of this edge contraction.

Overrides:
hashCode in class Object
Returns:
the hash code of this edge contraction