@Test public void populateOutputFieldsMap() { final List<KiePMMLOutputField> outputFields = new ArrayList<>(); KiePMMLOutputField predictedOutputField = getOutputField("KOF-TARGET", RESULT_FEATURE.PREDICTED_VALUE, "TARGET"); outputFields.add(predictedOutputField); final List<KiePMMLOutputField> probabilityOutputFields = IntStream.range(0, 2) .mapToObj(index -> getOutputField("KOF-PROB-" + index, RESULT_FEATURE.PROBABILITY, "PROB-" + index)) .collect(Collectors.toList()); outputFields.addAll(probabilityOutputFields); KiePMMLRegressionTableRegressionFactory.populateOutputFieldsMap(modelTemplate, outputFields); MethodDeclaration methodDeclaration = modelTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().get(); NodeList<Statement> retrieved = body.getStatements(); assertEquals(1, retrieved.size()); }
static void populateOutputFieldsMap(final ClassOrInterfaceDeclaration tableTemplate, final List<KiePMMLOutputField> outputFields) { MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, "populateOutputFieldsMapWithResult"))); populateOutputFieldsMapWithResult(body, outputFields); }
KiePMMLRegressionTableRegressionFactory { static void populateOutputFieldsMap(final ClassOrInterfaceDeclaration tableTemplate, final List<KiePMMLOutputField> outputFields) { MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, "populateOutputFieldsMapWithResult"))); populateOutputFieldsMapWithResult(body, outputFields); } }
KiePMMLRegressionTableRegressionFactory { static void populateOutputFieldsMap(final ClassOrInterfaceDeclaration tableTemplate, final List<KiePMMLOutputField> outputFields) { MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, "populateOutputFieldsMapWithResult"))); populateOutputFieldsMapWithResult(body, outputFields); } private  KiePMMLRegressionTableRegressionFactory(); }
KiePMMLRegressionTableRegressionFactory { static void populateOutputFieldsMap(final ClassOrInterfaceDeclaration tableTemplate, final List<KiePMMLOutputField> outputFields) { MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, "populateOutputFieldsMapWithResult"))); populateOutputFieldsMapWithResult(body, outputFields); } private  KiePMMLRegressionTableRegressionFactory(); static LinkedHashMap<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables,
                                                                                        final RegressionModel.NormalizationMethod normalizationMethod,
                                                                                        final List<KiePMMLOutputField> outputFields,
                                                                                        final String targetField,
                                                                                        final String packageName); static Map.Entry<String, String> getRegressionTable(final RegressionTable regressionTable,
                                                               final RegressionModel.NormalizationMethod normalizationMethod,
                                                               final List<KiePMMLOutputField> outputFields,
                                                               final String targetField,
                                                               final String packageName); }
KiePMMLRegressionTableRegressionFactory { static void populateOutputFieldsMap(final ClassOrInterfaceDeclaration tableTemplate, final List<KiePMMLOutputField> outputFields) { MethodDeclaration methodDeclaration = tableTemplate.getMethodsByName("populateOutputFieldsMapWithResult").get(0); BlockStmt body = methodDeclaration.getBody().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_BODY_TEMPLATE, "populateOutputFieldsMapWithResult"))); populateOutputFieldsMapWithResult(body, outputFields); } private  KiePMMLRegressionTableRegressionFactory(); static LinkedHashMap<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables,
                                                                                        final RegressionModel.NormalizationMethod normalizationMethod,
                                                                                        final List<KiePMMLOutputField> outputFields,
                                                                                        final String targetField,
                                                                                        final String packageName); static Map.Entry<String, String> getRegressionTable(final RegressionTable regressionTable,
                                                               final RegressionModel.NormalizationMethod normalizationMethod,
                                                               final List<KiePMMLOutputField> outputFields,
                                                               final String targetField,
                                                               final String packageName); static final String KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE_JAVA; static final String KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE; }