Class SearchNode
- java.lang.Object
-
- network.aika.neuron.activation.search.SearchNode
-
- All Implemented Interfaces:
Comparable<SearchNode>
public class SearchNode extends Object implements Comparable<SearchNode>
TheSearchNodeclass represents a node in the binary search tree that is used to find the optimal interpretation for a given document. Each search node possess a refinement (simply a set of interpretation nodes). The two options that this search node examines are that the refinement will either part of the final interpretation or not. During each search step the activation values in all the neuron activations adjusted such that they reflect the interpretation of the current search path. When the search reaches the maximum depth of the search tree and no further refinements exists, a weight is computed evaluating the current search path. The search path with the highest weight is used to determine the final interpretation.Before the search is started a set of initial refinements is generated from the conflicts within the document. In other words, if there are no conflicts in a given document, then no search is needed. In this case the final interpretation will simply be the set of all interpretation nodes. The initial refinements are then expanded, meaning all interpretation nodes that are consistent with this refinement are added to the refinement. The initial refinements are then propagated along the search path as refinement candidates.
- Author:
- Lukas Molzberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSearchNode.DebugStatestatic classSearchNode.TimeoutException
-
Field Summary
Fields Modifier and Type Field Description static booleanCOMPUTE_SOFT_MAXBranchexcludedstatic intMAX_SEARCH_STEPSstatic booleanOPTIMIZE_SEARCHBranchselected
-
Constructor Summary
Constructors Constructor Description SearchNode(Document doc, Decision d, SearchNode p, int level)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchangeState(Activation.Mode m)intcompareTo(SearchNode sn)static voidcomputeCachedFactor(SearchNode sn)voiddumpDebugState()booleanfollowPath()doublegetAccumulatedWeight()ActivationgetActivation()SearchNodegetAlternative()BranchgetBranch(Decision d)DecisiongetDecision()intgetId()Map<Activation,Option>getModifiedActivations()doublegetWeightSum()static voidinvalidateCachedDecision(Activation act)static voidsearch(Document doc, SearchNode root, long v, Long timeoutInMilliSeconds)Searches for the best interpretation for the given document.voidsetWeight(double w)StringtoString()voidupdateActivations(Document doc)
-
-
-
Constructor Detail
-
SearchNode
public SearchNode(Document doc, Decision d, SearchNode p, int level)
-
-
Method Detail
-
getAlternative
public SearchNode getAlternative()
-
updateActivations
public void updateActivations(Document doc) throws Activation.OscillatingActivationsException
-
followPath
public boolean followPath()
-
getId
public int getId()
-
getModifiedActivations
public Map<Activation,Option> getModifiedActivations()
-
getAccumulatedWeight
public double getAccumulatedWeight()
-
getActivation
public Activation getActivation()
-
search
public static void search(Document doc, SearchNode root, long v, Long timeoutInMilliSeconds) throws SearchNode.TimeoutException, Activation.RecursiveDepthExceededException, Activation.OscillatingActivationsException
Searches for the best interpretation for the given document.This implementation of the algorithm is iterative to prevent stack overflow errors from happening. Depending on the document the search tree might be getting very deep.
- Parameters:
doc-root-- Throws:
SearchNode.TimeoutExceptionActivation.RecursiveDepthExceededExceptionActivation.OscillatingActivationsException
-
setWeight
public void setWeight(double w)
-
getWeightSum
public double getWeightSum()
-
invalidateCachedDecision
public static void invalidateCachedDecision(Activation act)
-
computeCachedFactor
public static void computeCachedFactor(SearchNode sn)
-
changeState
public void changeState(Activation.Mode m)
-
compareTo
public int compareTo(SearchNode sn)
- Specified by:
compareToin interfaceComparable<SearchNode>
-
getDecision
public Decision getDecision()
-
dumpDebugState
public void dumpDebugState()
-
-