public boolean isGoal(KStagedElement state) throws KStagedAlgorithmException { return (0==state.getEvaluations().getMissingRelations()); }
if (currentEvaluation.getMissingNodes()<ancestorEvaluation.getMissingNodes()) improved=true; if (currentEvaluation.getMissingRelations()<ancestorEvaluation.getMissingRelations()) improved=true;
public boolean isGoal(KStagedElement state) { return (0==state.getEvaluations().getMissingRelations()); }
public static double getGap(SingleTreeEvaluations evaluations) { return evaluations.getMissingLemmas()+ evaluations.getMissingNodes()+ evaluations.getMissingRelations(); }
private static double getGapOfEvaluations(SingleTreeEvaluations evaluations) { return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); }
public static double getFutureEstimation(SingleTreeEvaluations evaluations) { return evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations(); }
public static double generateUnweightedFutureEstimationWithBelief(SingleTreeEvaluations evaluations,double belief,Set<String> hypothesisLemmasLowerCase,int numberOfHypothesisNodes) { double ret = 0; int missingRelations = evaluations.getMissingRelations(); if (0==missingRelations) // if it is goal { ret = 0; } else { int missingNodes = evaluations.getMissingNodes(); int missingLemmas = evaluations.getMissingLemmas(); missingRelations-=belief; missingNodes-=belief; missingLemmas-=belief; double missingNodesPortion = ((double)missingNodes) / ((double)numberOfHypothesisNodes); double missingRelationsPortion = ((double)missingRelations) / ((double)(numberOfHypothesisNodes-1)); double missingLemmasPortion = ((double)missingLemmas) / ((double)(hypothesisLemmasLowerCase.size())); ret = missingLemmasPortion+missingNodesPortion+missingRelationsPortion; } return ret; }
if (0==evaluations.getMissingRelations()) itIsGoal=true; logger.debug("Adding element with total-estimation: "+strDouble(element.getTotalEstimation())+", and cost: "+strDouble(cost)+", and future: "+strDouble(futureEstimation)+", and missing-relations = "+evaluations.getMissingRelations()); logger.debug("Added element spec: "+lastSpec.toString());
protected double getHeuristicGap(TreeAndParentMap<ExtendedInfo, ExtendedNode> tree) { SingleTreeEvaluations evaluations = new AlignmentCalculator(operationsEnvironment.getAlignmentCriteria(), tree, operationsEnvironment.getHypothesis()).getEvaluations(operationsEnvironment.getHypothesisLemmasLowerCase(), operationsEnvironment.getHypothesisNumberOfNodes()); return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); // return TreeUtilities.getHeuristicGap(tree, this.operationsEnvironment); }
private double gapOf(ExtendedNode textTree) throws TreeAndParentMapException { TreeAndParentMap<ExtendedInfo, ExtendedNode> tapm = new TreeAndParentMap<ExtendedInfo, ExtendedNode>(textTree); // SingleTreeEvaluations evaluations = SingleTreeEvaluations.create(tapm, this.operationsEnvironment.getHypothesis(), this.operationsEnvironment.getHypothesisLemmasLowerCase(),this.operationsEnvironment.getHypothesisNumberOfNodes()); SingleTreeEvaluations evaluations = new AlignmentCalculator(operationsEnvironment.getAlignmentCriteria(), tapm, operationsEnvironment.getHypothesis()).getEvaluations(operationsEnvironment.getHypothesisLemmasLowerCase(), operationsEnvironment.getHypothesisNumberOfNodes()); return (double) evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations(); }
if (0==evaluations.getMissingRelations()) itIsGoal=true;
if (0==evaluations.getMissingRelations()) itIsGoal=true; logger.debug("Adding element with total-estimation: "+strDouble(element.getTotalEstimation())+", and cost: "+strDouble(cost)+", and future: "+strDouble(futureEstimation)+", and missing-relations = "+evaluations.getMissingRelations()); logger.debug("Added element spec: "+lastSpec.toString());
/** * Returns a number that describes the gap between the given tree and the * hypothesis tree.<BR> * This number is based on the number of missing words, missing nodes * and missing relations (where "relation" is parent-child-label). * For more information see {@link SingleTreeEvaluations}. * @param tree * @return * @throws GapException */ @Override protected double getHeuristicGap(TreeAndParentMap<ExtendedInfo, ExtendedNode> tree, Map<Integer, Double> featureVector) throws GapException { if (hybridGapMode) { return gapTools.getGapHeuristicMeasure().measure(tree,featureVector,gapEnvironment); } else { // SingleTreeEvaluations evaluations = SingleTreeEvaluations.create(tree,operationsEnvironment.getHypothesis(),hypothesisLemmasLowerCase,hypothesisNumberOfNodes); SingleTreeEvaluations evaluations = new AlignmentCalculator(this.teSystemEnvironment.getAlignmentCriteria(),tree,operationsEnvironment.getHypothesis()).getEvaluations(hypothesisLemmasLowerCase,hypothesisNumberOfNodes); return (double)(evaluations.getMissingLemmas()+evaluations.getMissingNodes()+evaluations.getMissingRelations()); } }
boolean itIsGoal = (evaluations.getMissingRelations()==0); double unweightedFutureEstimation = GeneratedTreeStateCalculations.generateUnweightedFutureEstimation(evaluations); double futureEstimation = GeneratedTreeStateCalculations.generateFutureEstimation(evaluations,weightOfFuture);
logger.debug("No children for state with missing relations: "+evalsOriginalState.getMissingRelations());
if (0==evaluations.getMissingRelations()) itIsGoal=true; double unweightedFutureEstimation = GeneratedTreeStateCalculations.generateUnweightedFutureEstimation(evaluations); double futureEstimation = GeneratedTreeStateCalculations.generateFutureEstimation(evaluations,weightOfFuture);
double unweightedFutureEstimation = GeneratedTreeStateCalculations.generateUnweightedFutureEstimation(evaluations); double futureEstimation = GeneratedTreeStateCalculations.generateFutureEstimation(evaluations, this.weightOfFuture); boolean itIsGoal = (0==evaluations.getMissingRelations());