use of org.kie.pmml.models.clustering.model.KiePMMLClusteringModel in project drools by kiegroup.
the class ClusteringModelImplementationProviderTest method getKiePMMLModel.
@Test
public void getKiePMMLModel() throws Exception {
PMML pmml = TestUtils.loadFromFile(SOURCE_FILE);
ClusteringModel model = getModel(pmml);
final CommonCompilationDTO<ClusteringModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
KiePMMLClusteringModel retrieved = PROVIDER.getKiePMMLModel(compilationDTO);
assertNotNull(retrieved);
assertTrue(retrieved instanceof Serializable);
}
use of org.kie.pmml.models.clustering.model.KiePMMLClusteringModel in project drools by kiegroup.
the class KiePMMLClusteringModelFactory method getKiePMMLClusteringModel.
public static KiePMMLClusteringModel getKiePMMLClusteringModel(final CompilationDTO<ClusteringModel> compilationDTO) {
logger.trace("getKiePMMLClusteringModel {}", compilationDTO);
Map<String, String> sourcesMap = getKiePMMLClusteringModelSourcesMap(compilationDTO);
try {
Class<?> clusteringModelClass = compilationDTO.compileAndLoadClass(sourcesMap);
return (KiePMMLClusteringModel) clusteringModelClass.getDeclaredConstructor().newInstance();
} catch (Exception e) {
throw new KiePMMLException(e);
}
}
Aggregations