KiePMMLMiningModelFactory { public static KiePMMLMiningModel getKiePMMLMiningModel(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final MiningModel model, final KnowledgeBuilder kBuilder) { logger.debug("getKiePMMLMiningModel {}", model); String name = model.getModelName(); Optional<String> targetFieldName = getTargetFieldName(dataDictionary, model); List<KiePMMLExtension> extensions = getKiePMMLExtensions(model.getExtensions()); return KiePMMLMiningModel.builder(name, extensions, MINING_FUNCTION.byName(model.getMiningFunction().value())) .withAlgorithmName(model.getAlgorithmName()) .withScorable(model.isScorable()) .withSegmentation(getSegmentation(dataDictionary, transformationDictionary, model.getSegmentation(), String.format(SEGMENTATIONNAME_TEMPLATE, model.getModelName()), kBuilder)) .withTargetField(targetFieldName.orElse(null)) .build(); } private  KiePMMLMiningModelFactory(); static KiePMMLMiningModel getKiePMMLMiningModel(final DataDictionary dataDictionary,
                                                           final TransformationDictionary transformationDictionary,
                                                           final MiningModel model,
                                                           final KnowledgeBuilder kBuilder); static Map<String, String> getKiePMMLMiningModelSourcesMap(final DataDictionary dataDictionary,
                                                                      final TransformationDictionary transformationDictionary,
                                                                      final MiningModel model,
                                                                      final String parentPackageName,
                                                                      final KnowledgeBuilder kBuilder,
                                                                      final List<KiePMMLModel> nestedModels);  }
@Test public void getKiePMMLMiningModel() { final KiePMMLMiningModel retrieved = KiePMMLMiningModelFactory.getKiePMMLMiningModel(DATA_DICTIONARY, TRANSFORMATION_DICTIONARY, MINING_MODEL, KNOWLEDGE_BUILDER); assertNotNull(retrieved); assertEquals(MINING_MODEL.getAlgorithmName(), retrieved.getAlgorithmName()); assertEquals(MINING_MODEL.isScorable(), retrieved.isScorable()); final String expectedTargetField = "categoricalResult"; assertEquals(expectedTargetField, retrieved.getTargetField()); }