cc.mallet.grmm.inference
Class AbstractInferencer

java.lang.Object
  extended by cc.mallet.grmm.inference.AbstractInferencer
All Implemented Interfaces:
Inferencer, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AbstractBeliefPropagation, BruteForceInferencer, JunctionTreeInferencer, ParentChildGBP, SamplingInferencer, VariableElimination

public abstract class AbstractInferencer
extends java.lang.Object
implements Inferencer, java.lang.Cloneable

Abstract base class for inferencers. This simply throws an UnsupportedOperationException for all methods, which is useful for subclasses that want to implement only specific inference functionality. Created: Mon Oct 6 17:01:21 2003

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

Constructor Summary
AbstractInferencer()
           
 
Method Summary
abstract  void computeMarginals(FactorGraph fg)
          Computes marginal distributions for a factor graph.
 void dump()
           
 Inferencer duplicate()
           
 double lookupJoint(Assignment assn)
          Returns the joint probability of a given assignment, computed in some factorized fashion.
 double lookupLogJoint(Assignment assn)
          Returns the natural logarithm of the joint probability of a given assignment, computed in some factorized fashion.
abstract  Factor lookupMarginal(Variable variable)
          Returns the computed marginal of a given variable.
 Factor lookupMarginal(VarSet c)
          Returns the computed marginal of a given clique in a graph.
 double query(FactorGraph mdl, Assignment assn)
          Computes the marginal probability of a given assignment to a small number of model variables.
 void reportTime()
          Outputs some measure of the total time spent in this inferencer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInferencer

public AbstractInferencer()
Method Detail

computeMarginals

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

Specified by:
computeMarginals in interface Inferencer

lookupJoint

public double lookupJoint(Assignment assn)
Description copied from interface: Inferencer
Returns 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.

Specified by:
lookupJoint in interface Inferencer
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
See Also:
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph), #computeMarginals(JunctionTree)

lookupMarginal

public Factor lookupMarginal(VarSet c)
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
See Also:
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph), #computeMarginals(JunctionTree)

query

public double query(FactorGraph mdl,
                    Assignment assn)
Description copied from interface: Inferencer
Computes the marginal probability of a given assignment to a small number of model variables. This may require one run of computeMarginals() for each variable in the assignment; if the assigment has many variables, it may be more efficient to use lookupJoint.

Specified by:
query in interface Inferencer

lookupMarginal

public abstract Factor lookupMarginal(Variable variable)
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
See Also:
Inferencer.computeMarginals(FactorGraph)

duplicate

public Inferencer duplicate()
Specified by:
duplicate in interface Inferencer

dump

public void dump()
Specified by:
dump in interface Inferencer

reportTime

public void reportTime()
Description copied from interface: Inferencer
Outputs some measure of the total time spent in this inferencer.

Specified by:
reportTime in interface Inferencer