/** * Create an instance of {@link PPCell } * */ public PPCell createPPCell() { return new PPCell(); }
public FieldName getField(){ PPCell ppCell = getPPCell(); return ppCell.getField(); }
@Override public PPCell addExtensions(Extension... extensions) { getExtensions().addAll(Arrays.asList(extensions)); return this; }
@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()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
private CovariateHandler(PPCell ppCell){ super(ppCell); String value = ppCell.getValue(); if(value == null){ throw new MissingAttributeException(ppCell, PMMLAttributes.PPCELL_VALUE); } setExponent(Double.parseDouble(value)); }
@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()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
private FactorHandler(PPCell ppCell){ super(ppCell); String value = ppCell.getValue(); if(value == null){ throw new MissingAttributeException(ppCell, PMMLAttributes.PPCELL_VALUE); } setCategory(value); }
private PredictorHandler(PPCell ppCell){ setPPCell(ppCell); FieldName name = ppCell.getField(); if(name == null){ throw new MissingAttributeException(ppCell, PMMLAttributes.PPCELL_FIELD); } }
/** * Create an instance of {@link PPCell } * */ public PPCell createPPCell() { return new PPCell(); }
@Override public PPCell addExtensions(Extension... extensions) { getExtensions().addAll(Arrays.asList(extensions)); return this; }
@Override public VisitorAction visit(PPCell ppCell){ process(ppCell.getField()); return super.visit(ppCell); }
@Test public void inspectValueAnnotations(){ PMML pmml = createPMML(); FieldName name = FieldName.create("y"); Target target = new Target() .setField(name) .addTargetValues(createTargetValue("no event"), createTargetValue("event")); Targets targets = new Targets() .addTargets(target); GeneralRegressionModel model = new GeneralRegressionModel() .setTargets(targets); pmml.addModels(model); assertVersionRange(pmml, Version.PMML_3_0, Version.PMML_3_0); PPMatrix ppMatrix = new PPMatrix() .addPPCells(new PPCell(), new PPCell()); model.setPPMatrix(ppMatrix); assertVersionRange(pmml, Version.PMML_3_0, Version.PMML_4_3); target.setField(null); assertVersionRange(pmml, Version.PMML_4_3, Version.PMML_4_3); }
@Override public VisitorAction visit(PPCell ppCell){ process(ppCell.getField()); return super.visit(ppCell); }
@Override public Row apply(List<PPCell> ppCells){ Row result = new Row(); ppCells: for(PPCell ppCell : ppCells){ FieldName name = ppCell.getField(); if(name == null){ throw new MissingAttributeException(ppCell, PMMLAttributes.PPCELL_FIELD); } Predictor factor = this.factors.get(name); if(factor != null){ result.addFactor(ppCell, factor); continue ppCells; } Predictor covariate = this.covariates.get(name); if(covariate != null){ result.addCovariate(ppCell); continue ppCells; } throw new InvalidAttributeException(ppCell, PMMLAttributes.PPCELL_FIELD, name); } return result; } };