use of org.kie.pmml.models.regression.model.KiePMMLRegressionModel in project drools by kiegroup.
the class RegressionModelImplementationProviderTest method getKiePMMLModel.
@Test
public void getKiePMMLModel() throws Exception {
final PMML pmml = TestUtils.loadFromFile(SOURCE_1);
assertNotNull(pmml);
assertEquals(1, pmml.getModels().size());
assertTrue(pmml.getModels().get(0) instanceof RegressionModel);
RegressionModel regressionModel = (RegressionModel) pmml.getModels().get(0);
final CommonCompilationDTO<RegressionModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, regressionModel, new HasClassLoaderMock());
final KiePMMLRegressionModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
assertNotNull(retrieved);
assertTrue(retrieved instanceof Serializable);
}
use of org.kie.pmml.models.regression.model.KiePMMLRegressionModel in project drools by kiegroup.
the class KiePMMLRegressionModelFactoryTest method getKiePMMLRegressionModelClasses.
@Test
public void getKiePMMLRegressionModelClasses() throws IOException, IllegalAccessException, InstantiationException {
final CompilationDTO<RegressionModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, regressionModel, new HasClassLoaderMock());
KiePMMLRegressionModel retrieved = KiePMMLRegressionModelFactory.getKiePMMLRegressionModelClasses(RegressionCompilationDTO.fromCompilationDTO(compilationDTO));
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 AbstractKiePMMLTable regressionTable = retrieved.getRegressionTable();
assertNotNull(regressionTable);
assertTrue(regressionTable instanceof KiePMMLClassificationTable);
evaluateCategoricalRegressionTable((KiePMMLClassificationTable) regressionTable);
}
Aggregations