Search in sources :

Example 6 with ClusteringModel

use of org.dmg.pmml.clustering.ClusteringModel in project drools by kiegroup.

the class ClusteringModelImplementationProviderTest method getKiePMMLModelWithSources.

@Test
public void getKiePMMLModelWithSources() throws Exception {
    PMML pmml = TestUtils.loadFromFile(SOURCE_FILE);
    ClusteringModel model = getModel(pmml);
    final CommonCompilationDTO<ClusteringModel> compilationDTO = CommonCompilationDTO.fromGeneratedPackageNameAndFields(PACKAGE_NAME, pmml, model, new HasClassLoaderMock());
    KiePMMLModelWithSources retrieved = PROVIDER.getKiePMMLModelWithSources(compilationDTO);
    assertNotNull(retrieved);
    Map<String, String> sourcesMap = retrieved.getSourcesMap();
    assertNotNull(sourcesMap);
    assertFalse(sourcesMap.isEmpty());
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    Map<String, Class<?>> compiled = KieMemoryCompiler.compile(sourcesMap, classLoader);
    for (Class<?> clazz : compiled.values()) {
        assertTrue(clazz instanceof Serializable);
    }
}
Also used : KiePMMLModelWithSources(org.kie.pmml.commons.model.KiePMMLModelWithSources) Serializable(java.io.Serializable) PMML(org.dmg.pmml.PMML) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) KiePMMLClusteringModel(org.kie.pmml.models.clustering.model.KiePMMLClusteringModel) ClusteringModel(org.dmg.pmml.clustering.ClusteringModel) Test(org.junit.Test)

Aggregations

ClusteringModel (org.dmg.pmml.clustering.ClusteringModel)6 KiePMMLClusteringModel (org.kie.pmml.models.clustering.model.KiePMMLClusteringModel)4 ComparisonMeasure (org.dmg.pmml.ComparisonMeasure)3 Cluster (org.dmg.pmml.clustering.Cluster)3 Serializable (java.io.Serializable)2 ArrayList (java.util.ArrayList)2 PMML (org.dmg.pmml.PMML)2 SquaredEuclidean (org.dmg.pmml.SquaredEuclidean)2 Test (org.junit.Test)2 HasClassLoaderMock (org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock)2 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 NodeList (com.github.javaparser.ast.NodeList)1 ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)1 ConstructorDeclaration (com.github.javaparser.ast.body.ConstructorDeclaration)1 BooleanLiteralExpr (com.github.javaparser.ast.expr.BooleanLiteralExpr)1 DoubleLiteralExpr (com.github.javaparser.ast.expr.DoubleLiteralExpr)1 Expression (com.github.javaparser.ast.expr.Expression)1 NullLiteralExpr (com.github.javaparser.ast.expr.NullLiteralExpr)1 ObjectCreationExpr (com.github.javaparser.ast.expr.ObjectCreationExpr)1 BlockStmt (com.github.javaparser.ast.stmt.BlockStmt)1