PPMatrix ppMatrix = generalRegressionModel.getPPMatrix();
private <V extends Number> Value<V> computeDotProduct(ValueFactory<V> valueFactory, EvaluationContext context){ GeneralRegressionModel generalRegressionModel = getModel(); Map<String, Map<String, Row>> ppMatrixMap = getPPMatrixMap(); Map<String, Row> parameterPredictorRows; if(ppMatrixMap.isEmpty()){ parameterPredictorRows = Collections.emptyMap(); } else { parameterPredictorRows = ppMatrixMap.get(null); if(parameterPredictorRows == null){ PPMatrix ppMatrix = generalRegressionModel.getPPMatrix(); throw new InvalidElementException(ppMatrix); } } Map<String, List<PCell>> paramMatrixMap = getParamMatrixMap(); List<PCell> parameterCells = paramMatrixMap.get(null); if(paramMatrixMap.size() != 1 || parameterCells == null){ ParamMatrix paramMatrix = generalRegressionModel.getParamMatrix(); throw new InvalidElementException(paramMatrix); } return computeDotProduct(valueFactory, parameterCells, parameterPredictorRows, context); }
public GeneralRegressionModelEvaluator(PMML pmml, GeneralRegressionModel generalRegressionModel){ super(pmml, generalRegressionModel); GeneralRegressionModel.ModelType modelType = generalRegressionModel.getModelType(); if(modelType == null){ throw new MissingAttributeException(generalRegressionModel, PMMLAttributes.GENERALREGRESSIONMODEL_MODELTYPE); } ParameterList parameterList = generalRegressionModel.getParameterList(); if(parameterList == null){ throw new MissingElementException(generalRegressionModel, PMMLElements.GENERALREGRESSIONMODEL_PARAMETERLIST); } PPMatrix ppMatrix = generalRegressionModel.getPPMatrix(); if(ppMatrix == null){ throw new MissingElementException(generalRegressionModel, PMMLElements.GENERALREGRESSIONMODEL_PPMATRIX); } ParamMatrix paramMatrix = generalRegressionModel.getParamMatrix(); if(paramMatrix == null){ throw new MissingElementException(generalRegressionModel, PMMLElements.GENERALREGRESSIONMODEL_PARAMMATRIX); } }
PPMatrix ppMatrix = generalRegressionModel.getPPMatrix();
@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, getMiningSchema(), getOutput(), getModelStats(), getModelExplanation(), getTargets(), getLocalTransformations(), getParameterList(), getFactorList(), getCovariateList(), getPPMatrix(), getPCovMatrix(), getParamMatrix(), getEventValues(), getBaseCumHazardTables(), getModelVerification()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
@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, getMiningSchema(), getOutput(), getModelStats(), getModelExplanation(), getTargets(), getLocalTransformations(), getParameterList(), getFactorList(), getCovariateList(), getPPMatrix(), getPCovMatrix(), getParamMatrix(), getEventValues(), getBaseCumHazardTables(), getModelVerification()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }