Search in sources :

Example 1 with KiePMMLNode

use of org.kie.pmml.models.tree.model.KiePMMLNode in project drools by kiegroup.

the class KiePMMLNodeFactoryTest method getKiePMMLNode.

@Test
public void getKiePMMLNode() {
    final KiePMMLNode retrieved = KiePMMLNodeFactory.getKiePMMLNode(node1, getFieldsFromDataDictionaryAndDerivedFields(dataDictionary1, derivedFields1), PACKAGE_NAME, 1.0, new HasClassLoaderMock());
    assertNotNull(retrieved);
    commonVerifyNode(retrieved, node1);
}
Also used : KiePMMLNode(org.kie.pmml.models.tree.model.KiePMMLNode) HasClassLoaderMock(org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock) Test(org.junit.Test)

Example 2 with KiePMMLNode

use of org.kie.pmml.models.tree.model.KiePMMLNode in project drools by kiegroup.

the class KiePMMLNodeFactory method getKiePMMLNode.

public static KiePMMLNode getKiePMMLNode(final Node node, final List<Field<?>> fields, final String packageName, final Double missingValuePenalty, final HasClassLoader hasClassLoader) {
    logger.trace("getKiePMMLTreeNode {} {}", packageName, node);
    final KiePMMLNodeFactory.NodeNamesDTO nodeNamesDTO = new KiePMMLNodeFactory.NodeNamesDTO(node, createNodeClassName(), null, missingValuePenalty);
    final Map<String, String> sourcesMap = getKiePMMLNodeSourcesMap(nodeNamesDTO, fields, packageName);
    String fullClassName = packageName + "." + nodeNamesDTO.nodeClassName;
    try {
        Class<?> kiePMMLNodeClass = hasClassLoader.compileAndLoadClass(sourcesMap, fullClassName);
        return (KiePMMLNode) kiePMMLNodeClass.newInstance();
    } catch (Exception e) {
        throw new KiePMMLException(e);
    }
}
Also used : KiePMMLNode(org.kie.pmml.models.tree.model.KiePMMLNode) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException) KiePMMLInternalException(org.kie.pmml.api.exceptions.KiePMMLInternalException) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException)

Aggregations

KiePMMLNode (org.kie.pmml.models.tree.model.KiePMMLNode)2 Test (org.junit.Test)1 KiePMMLException (org.kie.pmml.api.exceptions.KiePMMLException)1 KiePMMLInternalException (org.kie.pmml.api.exceptions.KiePMMLInternalException)1 HasClassLoaderMock (org.kie.pmml.compiler.commons.mocks.HasClassLoaderMock)1