@Override public VisitorAction visit(Node node){ if(node.hasScoreDistributions()){ List<ScoreDistribution> scoreDistributions = node.getScoreDistributions(); for(ListIterator<ScoreDistribution> it = scoreDistributions.listIterator(); it.hasNext(); ){ it.set(intern(it.next())); } } return super.visit(node); }
@Override public VisitorAction visit(Node node){ if(node.hasScoreDistributions()){ List<ScoreDistribution> scoreDistributions = node.getScoreDistributions(); for(ListIterator<ScoreDistribution> it = scoreDistributions.listIterator(); it.hasNext(); ){ it.set(intern(it.next())); } } return super.visit(node); }
@Override public VisitorAction visit(Node node){ TreeModel treeModel = getTreeModel(); MiningFunction miningFunction = treeModel.getMiningFunction(); switch(miningFunction){ case REGRESSION: if(node.hasScoreDistributions()){ List<ScoreDistribution> scoreDistributions = node.getScoreDistributions(); scoreDistributions.clear(); } break; default: break; } return super.visit(node); }
@Override protected <V extends Number> Map<FieldName, ?> evaluateClassification(ValueFactory<V> valueFactory, EvaluationContext context){ TreeModel treeModel = getModel(); TargetField targetField = getTargetField(); Trail trail = new Trail(); Node node = evaluateTree(trail, context); if(node == null){ return TargetUtil.evaluateClassificationDefault(valueFactory, targetField); } // End if if(!node.hasScoreDistributions()){ NodeVote result = createNodeVote(node); return TargetUtil.evaluateVote(targetField, result); } double missingValuePenalty = 1d; int missingLevels = trail.getMissingLevels(); if(missingLevels > 0){ missingValuePenalty = Math.pow(treeModel.getMissingValuePenalty(), missingLevels); } NodeScoreDistribution<V> result = createNodeScoreDistribution(valueFactory, node, missingValuePenalty); return TargetUtil.evaluateClassification(targetField, result); }
static public ComplexNode toComplexNode(Node node){ ComplexNode result = new ComplexNode() .setId(node.getId()) .setScore(node.getScore()) .setRecordCount(node.getRecordCount()) .setDefaultChild(node.getDefaultChild()) .setPredicate(node.getPredicate()); if(node.hasNodes()){ (result.getNodes()).addAll(node.getNodes()); } // End if if(node.hasScoreDistributions()){ (result.getScoreDistributions()).addAll(node.getScoreDistributions()); } return result; } }
value.setPartition(node.getPartition()); if(node.hasScoreDistributions()){ (value.getScoreDistributions()).addAll(node.getScoreDistributions());
value.setPartition(node.getPartition()); if(node.hasScoreDistributions()){ (value.getScoreDistributions()).addAll(node.getScoreDistributions());