LabelType
- NodeNameType
- public class EdgeMergingEnergyFunction<LabelType,NodeNameType> extends java.lang.Object implements NodeNameAwareEnergyFunction<LabelType,NodeNameType>
Constructor and Description |
---|
EdgeMergingEnergyFunction(NodeNameAwareEnergyFunction<LabelType,NodeNameType> wrapMe)
Initializes this edge merging energy function
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<LabelType,java.lang.Double> |
getBeliefs(NodeNameType node,
EnergyFunctionSolver<LabelType> bp)
Get the probabilities for each label for the input node as produced by
the input belief propagation run.
|
Pair<java.lang.Integer,java.lang.Integer> |
getEdge(int i)
Returns the indices for the two endpoints in the specified path.
|
double |
getPairwiseCost(int edgeId,
LabelType ilabel,
LabelType jlabel)
This is the -log(getPairwisePotential(.)).
|
double |
getPairwisePotential(int edgeId,
LabelType ilabel,
LabelType jlabel)
Returns the pairwise cost of node i being assigned label_i and node j
being assigned label_j.
|
java.util.Collection<LabelType> |
getPossibleLabels(int nodeId)
Returns the set of labels that this message passer supports
|
double |
getUnaryCost(int i,
LabelType label)
This is the -log(getUnaryPotential(.)).
|
double |
getUnaryPotential(int i,
LabelType label)
Returns the unary cost for node i having the input label.
|
int |
numEdges()
Returns the number of paths that messages should be passed down.
|
int |
numNodes()
Returns the number of nodes in the energy function.
|
void |
setLabel(NodeNameType node,
LabelType label)
Set the label for the input node
|
public EdgeMergingEnergyFunction(NodeNameAwareEnergyFunction<LabelType,NodeNameType> wrapMe)
wrapMe
- The energy function to wrappublic void setLabel(NodeNameType node, LabelType label)
NodeNameAwareEnergyFunction
setLabel
in interface NodeNameAwareEnergyFunction<LabelType,NodeNameType>
NodeNameAwareEnergyFunction.setLabel(java.lang.Object,
java.lang.Object)
public java.util.Map<LabelType,java.lang.Double> getBeliefs(NodeNameType node, EnergyFunctionSolver<LabelType> bp)
NodeNameAwareEnergyFunction
getBeliefs
in interface NodeNameAwareEnergyFunction<LabelType,NodeNameType>
NodeNameAwareEnergyFunction.getBeliefs(java.lang.Object,
gov.sandia.cognition.graph.inference.EnergyFunctionSolver)
public java.util.Collection<LabelType> getPossibleLabels(int nodeId)
EnergyFunction
getPossibleLabels
in interface EnergyFunction<LabelType>
nodeId
- The node whose labels is wantedEnergyFunction.getPossibleLabels(int)
public int numEdges()
EnergyFunction
EnergyFunction.getEdge(int)
method, all paths can be
retrieved.numEdges
in interface EnergyFunction<LabelType>
EnergyFunction.numEdges()
public int numNodes()
EnergyFunction
numNodes
in interface EnergyFunction<LabelType>
EnergyFunction.numNodes()
public Pair<java.lang.Integer,java.lang.Integer> getEdge(int i)
EnergyFunction
EnergyFunction.numEdges()
- 1) should return a non-null value. All path IDs outside that range
should throw an Exception.getEdge
in interface EnergyFunction<LabelType>
i
- The path ID (should be in [0 ... EnergyFunction.numEdges()
) ).#getUnaryCost(int)
and #getPairwisePotential(int, int, Object, Object)
)EnergyFunction.getEdge(int)
public double getUnaryPotential(int i, LabelType label)
EnergyFunction
EnergyFunction.getEdge(int)
. If not, an exception
should be thrown.getUnaryPotential
in interface EnergyFunction<LabelType>
i
- The index of the node whose unary cost should be returnedlabel
- The label that could be applied to the nodeEnergyFunction.getUnaryPotential(int, java.lang.Object)
public double getPairwisePotential(int edgeId, LabelType ilabel, LabelType jlabel)
EnergyFunction
EnergyFunction.getEdge(int)
in the ordere specified by the returned pair (i
= getFirst, j = getSecond). If not, an exception should be thrown.getPairwisePotential
in interface EnergyFunction<LabelType>
edgeId
- The id for the edge being requestedilabel
- The label being (possibly) assigned to node ijlabel
- The label being (possibly) assigned to node jEnergyFunction.getPairwisePotential(int,
java.lang.Object, java.lang.Object)
public double getUnaryCost(int i, LabelType label)
EnergyFunction
getUnaryCost
in interface EnergyFunction<LabelType>
EnergyFunction.getUnaryCost(int, java.lang.Object)
public double getPairwiseCost(int edgeId, LabelType ilabel, LabelType jlabel)
EnergyFunction
getPairwiseCost
in interface EnergyFunction<LabelType>
EnergyFunction.getPairwiseCost(int, java.lang.Object,
java.lang.Object)