|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cc.mallet.grmm.inference.AbstractInferencer cc.mallet.grmm.inference.AbstractBeliefPropagation
public abstract class AbstractBeliefPropagation
Abstract base class for umplementations of belief propagation for general factor graphs. This class manages arrays of messages, computing beliefs from messages, and convergence thresholds.
How to send individual messages (e.g., sum-product, max-product, etc) are mananged by istances of the interface @link{#MessageStrategy}. Concrete subclasses decide which order to send messages in.
Nested Class Summary | |
---|---|
static class |
AbstractBeliefPropagation.AbstractMessageStrategy
|
static class |
AbstractBeliefPropagation.MaxProductMessageStrategy
|
static interface |
AbstractBeliefPropagation.MessageStrategy
|
static class |
AbstractBeliefPropagation.SumProductMessageStrategy
|
Field Summary | |
---|---|
protected int[] |
assignedVertexPtls
|
protected int |
iterUsed
|
protected static java.util.logging.Logger |
logger
|
protected FactorGraph |
mdlCurrent
|
protected boolean |
normalizeBeliefs
|
protected boolean |
useCaching
|
Constructor Summary | |
---|---|
protected |
AbstractBeliefPropagation()
|
protected |
AbstractBeliefPropagation(AbstractBeliefPropagation.MessageStrategy messager)
|
Method Summary | |
---|---|
protected void |
copyOldMessages()
|
protected void |
doneWithGraph(FactorGraph mdl)
|
void |
dump()
|
void |
dump(java.io.PrintWriter writer)
|
AbstractBeliefPropagation.MessageStrategy |
getMessager()
|
int |
getMessagesSent()
Returns the total number of messages this inferencer has sent since its creation. |
int |
getMessagesUsedLastTime()
Returns the number of messages sent during the last call to computeMarginals. |
static int |
getTotalMessagesSent()
Returns the total number of messages all BP inferencers have sent in the current Java image. |
protected boolean |
hasConverged()
|
protected boolean |
hasConverged(double threshold)
|
protected void |
initForGraph(FactorGraph mdl)
|
int |
iterationsUsed()
|
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 c)
Returns the computed marginal of a given clique in a graph. |
void |
reportTime()
Outputs some measure of the total time spent in this inferencer. |
protected void |
resetMessagesSentAtStart()
|
protected void |
sendMessage(FactorGraph mdl,
Factor from,
Variable to)
|
protected void |
sendMessage(FactorGraph mdl,
Variable from,
Factor to)
|
AbstractBeliefPropagation |
setMessager(AbstractBeliefPropagation.MessageStrategy messager)
|
Methods inherited from class cc.mallet.grmm.inference.AbstractInferencer |
---|
computeMarginals, duplicate, lookupJoint, query |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.logging.Logger logger
protected boolean normalizeBeliefs
protected boolean useCaching
protected transient int iterUsed
protected transient FactorGraph mdlCurrent
protected transient int[] assignedVertexPtls
Constructor Detail |
---|
protected AbstractBeliefPropagation()
protected AbstractBeliefPropagation(AbstractBeliefPropagation.MessageStrategy messager)
Method Detail |
---|
public AbstractBeliefPropagation.MessageStrategy getMessager()
public AbstractBeliefPropagation setMessager(AbstractBeliefPropagation.MessageStrategy messager)
public static int getTotalMessagesSent()
public int getMessagesSent()
public int getMessagesUsedLastTime()
protected void resetMessagesSentAtStart()
protected final void copyOldMessages()
protected final boolean hasConverged()
protected final boolean hasConverged(double threshold)
protected void initForGraph(FactorGraph mdl)
protected void sendMessage(FactorGraph mdl, Variable from, Factor to)
protected void sendMessage(FactorGraph mdl, Factor from, Variable to)
protected void doneWithGraph(FactorGraph mdl)
public int iterationsUsed()
public Factor lookupMarginal(Variable var)
Inferencer
lookupMarginal
in interface Inferencer
lookupMarginal
in class AbstractInferencer
Inferencer.computeMarginals(FactorGraph)
public void dump()
dump
in interface Inferencer
dump
in class AbstractInferencer
public void reportTime()
Inferencer
reportTime
in interface Inferencer
reportTime
in class AbstractInferencer
public void dump(java.io.PrintWriter writer)
public Factor lookupMarginal(VarSet c)
Inferencer
lookupMarginal
in interface Inferencer
lookupMarginal
in class AbstractInferencer
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph)
,
#computeMarginals(JunctionTree)
public double lookupLogJoint(Assignment assn)
Inferencer
This method is less likely to underflow than
Math.log (lookupJoint (assn))
.
lookupLogJoint
in interface Inferencer
lookupLogJoint
in class AbstractInferencer
Inferencer.computeMarginals(cc.mallet.grmm.types.FactorGraph)
,
#computeMarginals(JunctionTree)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |