LabelType
- The type for labels@PublicationReference(author="Jonahtan S. Yedidia, William T. Freeman, and Yair Weiss", title="Understanding Belief Propagation and its Generalizations", type=TechnicalReport, year=2001, notes="Institution: Mitsubishi Electric Research Laboratories") public abstract class SumProductInferencingAlgorithm<LabelType> extends java.lang.Object implements EnergyFunctionSolver<LabelType>
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_EPS
The default stopping epsilon that will be used
|
static int |
DEFAULT_MAX_ITERATIONS
The default maximum number of iterations that will be run
|
static int |
DEFAULT_NUM_THREADS
The default number of threads that will be used
|
protected EnergyFunction<LabelType> |
fn
The input energy function to learn against
|
protected java.util.List<gov.sandia.cognition.graph.inference.Node<LabelType>> |
nodes
This internally stores the nodes with their values for the learning
|
Constructor and Description |
---|
SumProductInferencingAlgorithm()
Creates a new solver with the default settings.
|
SumProductInferencingAlgorithm(int maxNumIterations)
Creates a new solver with the default settings excepting max number of
iterations.
|
SumProductInferencingAlgorithm(int maxNumIterations,
double eps,
int numThreads)
Creates a new solver with the specified settings.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
computeTemporaryMessage(int edge)
Private helper that computes the temporary message for the specified edge
for the current iteration going in the specified direction (a different
message for each direction)
|
double |
getBelief(int i,
int label)
Gets the belief for node i with the specified label.
|
void |
init(EnergyFunction<LabelType> f)
Initializes internal state and stores the energy function for future
solutions.
|
boolean |
solve()
Solves for the energy function passed in during initialize, e.g., compute
the beliefs.
|
public static final double DEFAULT_EPS
public static final int DEFAULT_MAX_ITERATIONS
public static final int DEFAULT_NUM_THREADS
protected java.util.List<gov.sandia.cognition.graph.inference.Node<LabelType>> nodes
protected EnergyFunction<LabelType> fn
public SumProductInferencingAlgorithm(int maxNumIterations, double eps, int numThreads)
maxNumIterations
- The maximum number of iterations that will be runeps
- The stopping epsilon that will be usednumThreads
- The number of threads that will be usedpublic SumProductInferencingAlgorithm(int maxNumIterations)
maxNumIterations
- The maximum number of iterations that will be runpublic SumProductInferencingAlgorithm()
public boolean solve()
EnergyFunctionSolver
solve
in interface EnergyFunctionSolver<LabelType>
protected abstract void computeTemporaryMessage(int edge)
edge
- The edge to compute the temporary message for (you can't
replace the current message yet as the current message may be needed for
other edges).public void init(EnergyFunction<LabelType> f)
EnergyFunctionSolver
init
in interface EnergyFunctionSolver<LabelType>
f
- The energy function to initialize againstpublic double getBelief(int i, int label)
EnergyFunctionSolver
getBelief
in interface EnergyFunctionSolver<LabelType>
i
- The index of the node whose belief associated with the input
label is wantedlabel
- The label for the node whose belief is desired