KiePMMLRegressionModelFactory { public static KiePMMLRegressionModel getKiePMMLRegressionModelClasses(final DataDictionary dataDictionary, final TransformationDictionary transformationDictionary, final RegressionModel model) throws IOException, IllegalAccessException, InstantiationException { logger.trace("getKiePMMLRegressionModelClasses {} {}", dataDictionary, model); String className = getSanitizedClassName(model.getModelName()); String packageName = getSanitizedPackageName(model.getModelName()); Map<String, String> sourcesMap = getKiePMMLRegressionModelSourcesMap(dataDictionary, transformationDictionary, model, packageName); String fullClassName = packageName + "." + className; final Map<String, Class<?>> compiledClasses = KieMemoryCompiler.compile(sourcesMap, Thread.currentThread().getContextClassLoader()); return (KiePMMLRegressionModel) compiledClasses.get(fullClassName).newInstance(); } private  KiePMMLRegressionModelFactory(); static KiePMMLRegressionModel getKiePMMLRegressionModelClasses(final DataDictionary dataDictionary,
                                                                          final TransformationDictionary transformationDictionary,
                                                                          final RegressionModel model); static Map<String, String> getKiePMMLRegressionModelSourcesMap(final DataDictionary dataDictionary,
                                                                          final TransformationDictionary transformationDictionary,
                                                                          final RegressionModel model,
                                                                          final String packageName);  }
@Test public void getKiePMMLRegressionModelClasses() throws IOException, IllegalAccessException, InstantiationException { KiePMMLRegressionModel retrieved = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelClasses(dataDictionary, transformationDictionary, regressionModel); assertNotNull(retrieved); assertEquals(regressionModel.getModelName(), retrieved.getName()); assertEquals(MINING_FUNCTION.byName(regressionModel.getMiningFunction().value()), retrieved.getMiningFunction()); assertEquals(miningFields.get(0).getName().getValue(), retrieved.getTargetField()); final KiePMMLRegressionTable regressionTable = retrieved.getRegressionTable(); assertNotNull(regressionTable); assertTrue(regressionTable instanceof KiePMMLRegressionClassificationTable); evaluateCategoricalRegressionTable((KiePMMLRegressionClassificationTable) regressionTable); }