/** * Create an instance of {@link ComplexNode } * */ public ComplexNode createComplexNode() { return new ComplexNode(); }
public ComplexNode addNodes(org.dmg.pmml.tree.Node... nodes) { getNodes().addAll(Arrays.asList(nodes)); return this; }
public ComplexNode addScoreDistributions(ScoreDistribution... scoreDistributions) { getScoreDistributions().addAll(Arrays.asList(scoreDistributions)); return this; }
ComplexNode value = new ComplexNode(); value.setId(node.getId()); value.setScore(node.getScore()); value.setRecordCount(node.getRecordCount()); value.setDefaultChild(node.getDefaultChild()); (value.getExtensions()).addAll(node.getExtensions()); value.setPredicate(node.getPredicate()); value.setPartition(node.getPartition()); (value.getScoreDistributions()).addAll(node.getScoreDistributions()); (value.getNodes()).addAll(node.getNodes()); value.setEmbeddedModel(node.getEmbeddedModel());
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; } }
Node rightChild = encodeNode(rightPredicate, predicateManager, scoreDistributionManager, rightIndex, leftChildren, rightChildren, features, thresholds, values, miningFunction, schema); Node result = new ComplexNode() .setId(id) .setPredicate(predicate) .addNodes(leftChild, rightChild); result = new ComplexNode() .setId(id) .setScore(score) .setRecordCount(totalRecordCount) .setPredicate(predicate); double value = values[index]; result = new ComplexNode() .setId(id) .setScore(value) .setPredicate(predicate); } else
@Override public Node unmarshal(ComplexNode value){ if(value.getRecordCount() != null){ return value; } // End if if(value.hasExtensions() || (value.getPartition() != null) || value.hasScoreDistributions() || (value.getEmbeddedModel() != null)){ return value; } Node node; if(value.hasNodes()){ node = new BranchNode() .setId(value.getId()) .setDefaultChild(value.getDefaultChild()); (node.getNodes()).addAll(value.getNodes()); } else { node = new LeafNode() .setId(value.getId()); } node .setScore(value.getScore()) .setPredicate(value.getPredicate()); return node; }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = PMMLObject.traverse(visitor, getExtensions()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getPredicate(), getPartition()); } if ((status == VisitorAction.CONTINUE)&&hasScoreDistributions()) { status = PMMLObject.traverse(visitor, getScoreDistributions()); } if ((status == VisitorAction.CONTINUE)&&hasNodes()) { status = PMMLObject.traverse(visitor, getNodes()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getEmbeddedModel()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
Node node2a = new ComplexNode() .setId("2a") .addExtensions(new Extension()) .setPredicate(new False());
Node root = new ComplexNode() .setPredicate(new True()) .setScore(ValueUtil.formatValue(classes.get(index)));
List<? extends Feature> features = schema.getFeatures(); Node result = new ComplexNode() .setId(String.valueOf(id.asScalar())) .setPredicate(predicate);
ComplexNode value = new ComplexNode(); value.setId(node.getId()); value.setScore(node.getScore()); value.setRecordCount(node.getRecordCount()); value.setDefaultChild(node.getDefaultChild()); (value.getExtensions()).addAll(node.getExtensions()); value.setPredicate(node.getPredicate()); value.setPartition(node.getPartition()); (value.getScoreDistributions()).addAll(node.getScoreDistributions()); (value.getNodes()).addAll(node.getNodes()); value.setEmbeddedModel(node.getEmbeddedModel());
@Override public Node unmarshal(ComplexNode value){ if(value.getRecordCount() != null){ return value; } // End if if(value.hasExtensions() || (value.getPartition() != null) || value.hasScoreDistributions() || (value.getEmbeddedModel() != null)){ return value; } Node node; if(value.hasNodes()){ node = new BranchNode() .setId(value.getId()) .setDefaultChild(value.getDefaultChild()); (node.getNodes()).addAll(value.getNodes()); } else { node = new LeafNode() .setId(value.getId()); } node .setScore(value.getScore()) .setPredicate(value.getPredicate()); return node; }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = PMMLObject.traverse(visitor, getExtensions()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getPredicate(), getPartition()); } if ((status == VisitorAction.CONTINUE)&&hasScoreDistributions()) { status = PMMLObject.traverse(visitor, getScoreDistributions()); } if ((status == VisitorAction.CONTINUE)&&hasNodes()) { status = PMMLObject.traverse(visitor, getNodes()); } if (status == VisitorAction.CONTINUE) { status = PMMLObject.traverse(visitor, getEmbeddedModel()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
/** * Create an instance of {@link ComplexNode } * */ public ComplexNode createComplexNode() { return new ComplexNode(); }
public ComplexNode addScoreDistributions(ScoreDistribution... scoreDistributions) { getScoreDistributions().addAll(Arrays.asList(scoreDistributions)); return this; }
public ComplexNode addNodes(org.dmg.pmml.tree.Node... nodes) { getNodes().addAll(Arrays.asList(nodes)); return this; }