cc.mallet.grmm.inference
Class JunctionTreeInferencer

java.lang.Object
  extended by cc.mallet.grmm.inference.AbstractInferencer
      extended by cc.mallet.grmm.inference.JunctionTreeInferencer
All Implemented Interfaces:
Inferencer, java.io.Serializable, java.lang.Cloneable

public class JunctionTreeInferencer
extends AbstractInferencer

Does inference in general graphical models using the Hugin junction tree algorithm. Created: Mon Nov 10 23:58:44 2003

Version:
$Id: JunctionTreeInferencer.java,v 1.1 2007/10/22 21:37:49 mccallum Exp $
Author:
Charles Sutton
See Also:
Serialized Form

Field Summary
protected  JunctionTree jtCurrent
           
 
Constructor Summary
JunctionTreeInferencer()
           
JunctionTreeInferencer(cc.mallet.grmm.inference.JunctionTreePropagation propagator)
           
 
Method Summary
 JunctionTree buildJunctionTree(FactorGraph mdl)
          Constructs a junction tree from a given factor graph.
 void computeMarginals(FactorGraph mdl)
          Computes marginal distributions for a factor graph.
 void computeMarginals(JunctionTree jt)
           
static JunctionTreeInferencer createForMaxProduct()
           
 void dump()
           
 double dumpLogJoint(Assignment assn)
           
 int getTotalMessagesSent()
          Returns the total number of messages this inferencer has sent.
 JunctionTree lookupJunctionTree()
          Returns the JunctionTree computed from the last call to computeMarginals(cc.mallet.grmm.types.FactorGraph).
 double lookupLogJoint(Assignment assn)
          Returns the natural logarithm of the joint probability of a given assignment, computed in some factorized fashion.
 Factor lookupMarginal(Variable var)
          Returns the computed marginal of a given variable.
 Factor lookupMarginal(VarSet varSet)
          Returns the computed marginal of a given clique in a graph.
 Variable pickVertexToRemove(org._3pq.jgrapht.UndirectedGraph mdl, java.util.ArrayList lst)
           
 
Methods inherited from class cc.mallet.grmm.inference.AbstractInferencer
duplicate, lookupJoint, query, reportTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jtCurrent

protected transient JunctionTree jtCurrent
Constructor Detail

JunctionTreeInferencer

public JunctionTreeInferencer()

JunctionTreeInferencer

public JunctionTreeInferencer(cc.mallet.grmm.inference.JunctionTreePropagation propagator)
Method Detail

createForMaxProduct

public static JunctionTreeInferencer createForMaxProduct()

pickVertexToRemove

public Variable pickVertexToRemove(org._3pq.jgrapht.UndirectedGraph mdl,
                                   java.util.ArrayList lst)

computeMarginals

public void computeMarginals(FactorGraph mdl)
Description copied from interface: Inferencer
Computes marginal distributions for a factor graph.

Specified by:
computeMarginals in interface Inferencer
Specified by:
computeMarginals in class AbstractInferencer

computeMarginals

public void computeMarginals(JunctionTree jt)

buildJunctionTree

public JunctionTree buildJunctionTree(FactorGraph mdl)
Constructs a junction tree from a given factor graph. Does not perform BP in the resulting graph. So this gives you the structure of a jnuction tree, but the factors don't correspond to the true marginals unless you call BP yourself.

Parameters:
mdl - Factor graph to compute JT for.

lookupMarginal

public Factor lookupMarginal(Variable var)
Description copied from interface: Inferencer
Returns the computed marginal of a given variable. Before using this method, computeMarginals must have been previously called on the graphical model that contains v.

Specified by:
lookupMarginal in interface Inferencer
Specified by:
lookupMarginal in class AbstractInferencer
See Also:
Inferencer.computeMarginals(FactorGraph)

lookupMarginal

public Factor lookupMarginal(VarSet varSet)
Description copied from interface: Inferencer
Returns the computed marginal of a given clique in a graph. Before using this method, computeMarginals must have been previously called on the graphical model that contains the clique.

Specified by:
lookupMarginal in interface Inferencer
Overrides:
lookupMarginal in class AbstractInferencer
See Also:
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph), #computeMarginals(JunctionTree)

lookupLogJoint

public double lookupLogJoint(Assignment assn)
Description copied from interface: Inferencer
Returns the natural logarithm of the joint probability of a given assignment, computed in some factorized fashion. Before using this method, computeMarginals must have been previously called on the graphical model that contains the variables of assn.

This method is less likely to underflow than Math.log (lookupJoint (assn)).

Specified by:
lookupLogJoint in interface Inferencer
Overrides:
lookupLogJoint in class AbstractInferencer
See Also:
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph), #computeMarginals(JunctionTree)

dumpLogJoint

public double dumpLogJoint(Assignment assn)

lookupJunctionTree

public JunctionTree lookupJunctionTree()
Returns the JunctionTree computed from the last call to computeMarginals(cc.mallet.grmm.types.FactorGraph). Caller must not modify return value.


dump

public void dump()
Specified by:
dump in interface Inferencer
Overrides:
dump in class AbstractInferencer

getTotalMessagesSent

public int getTotalMessagesSent()
Returns the total number of messages this inferencer has sent.