@Test public void getRegressionTables() { RegressionTable regressionTableProf = getRegressionTable(3.5, "professional"); RegressionTable regressionTableCler = getRegressionTable(27.4, "clerical"); List<RegressionTable> regressionTables = Arrays.asList(regressionTableProf, regressionTableCler); KiePMMLOutputField outputFieldCat = getOutputField("CAT-1", RESULT_FEATURE.PROBABILITY, "CatPred-1"); KiePMMLOutputField outputFieldNum = getOutputField("NUM-1", RESULT_FEATURE.PROBABILITY, "NumPred-0"); KiePMMLOutputField outputFieldPrev = getOutputField("PREV", RESULT_FEATURE.PREDICTED_VALUE, null); List<KiePMMLOutputField> outputFields = Arrays.asList(outputFieldCat, outputFieldNum, outputFieldPrev); Map<String, KiePMMLTableSourceCategory> retrieved = KiePMMLRegressionTableClassificationFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.SOFTMAX, OpType.CATEGORICAL, outputFields, "targetField", "packageName"); assertNotNull(retrieved); assertEquals(3, retrieved.size()); retrieved.values().forEach(kiePMMLTableSourceCategory -> commonValidateKiePMMLRegressionTable(kiePMMLTableSourceCategory.getSource())); }
public static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName) { logger.trace("getRegressionTables {}", regressionTables); LinkedHashMap<String, KiePMMLTableSourceCategory> toReturn = KiePMMLRegressionTableRegressionFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.NONE, outputFields, targetField, packageName); Map.Entry<String, String> regressionTableEntry = getRegressionTable(toReturn, normalizationMethod, opType, outputFields, targetField, packageName); toReturn.put(regressionTableEntry.getKey(), new KiePMMLTableSourceCategory(regressionTableEntry.getValue(), "")); return toReturn; }
KiePMMLRegressionTableClassificationFactory { public static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName) { logger.trace("getRegressionTables {}", regressionTables); LinkedHashMap<String, KiePMMLTableSourceCategory> toReturn = KiePMMLRegressionTableRegressionFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.NONE, outputFields, targetField, packageName); Map.Entry<String, String> regressionTableEntry = getRegressionTable(toReturn, normalizationMethod, opType, outputFields, targetField, packageName); toReturn.put(regressionTableEntry.getKey(), new KiePMMLTableSourceCategory(regressionTableEntry.getValue(), "")); return toReturn; } }
KiePMMLRegressionTableClassificationFactory { public static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName) { logger.trace("getRegressionTables {}", regressionTables); LinkedHashMap<String, KiePMMLTableSourceCategory> toReturn = KiePMMLRegressionTableRegressionFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.NONE, outputFields, targetField, packageName); Map.Entry<String, String> regressionTableEntry = getRegressionTable(toReturn, normalizationMethod, opType, outputFields, targetField, packageName); toReturn.put(regressionTableEntry.getKey(), new KiePMMLTableSourceCategory(regressionTableEntry.getValue(), "")); return toReturn; } private  KiePMMLRegressionTableClassificationFactory(); }
KiePMMLRegressionTableClassificationFactory { public static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName) { logger.trace("getRegressionTables {}", regressionTables); LinkedHashMap<String, KiePMMLTableSourceCategory> toReturn = KiePMMLRegressionTableRegressionFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.NONE, outputFields, targetField, packageName); Map.Entry<String, String> regressionTableEntry = getRegressionTable(toReturn, normalizationMethod, opType, outputFields, targetField, packageName); toReturn.put(regressionTableEntry.getKey(), new KiePMMLTableSourceCategory(regressionTableEntry.getValue(), "")); return toReturn; } private  KiePMMLRegressionTableClassificationFactory(); static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static Map.Entry<String, String> getRegressionTable(final LinkedHashMap<String, KiePMMLTableSourceCategory> regressionTablesMap, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); }
KiePMMLRegressionTableClassificationFactory { public static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName) { logger.trace("getRegressionTables {}", regressionTables); LinkedHashMap<String, KiePMMLTableSourceCategory> toReturn = KiePMMLRegressionTableRegressionFactory.getRegressionTables(regressionTables, RegressionModel.NormalizationMethod.NONE, outputFields, targetField, packageName); Map.Entry<String, String> regressionTableEntry = getRegressionTable(toReturn, normalizationMethod, opType, outputFields, targetField, packageName); toReturn.put(regressionTableEntry.getKey(), new KiePMMLTableSourceCategory(regressionTableEntry.getValue(), "")); return toReturn; } private  KiePMMLRegressionTableClassificationFactory(); static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static Map.Entry<String, String> getRegressionTable(final LinkedHashMap<String, KiePMMLTableSourceCategory> regressionTablesMap, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static final String KIE_PMML_REGRESSION_TABLE_CLASSIFICATION_TEMPLATE_JAVA; static final String KIE_PMML_REGRESSION_TABLE_CLASSIFICATION_TEMPLATE; }