Search in sources :

Example 6 with KiePMMLParameterField

use of org.kie.pmml.commons.transformations.KiePMMLParameterField in project drools by kiegroup.

the class KiePMMLParameterFieldInstanceFactoryTest method getKiePMMLParameterField.

@Test
public void getKiePMMLParameterField() {
    final String fieldName = "fieldName";
    final ParameterField toConvert = getParameterField(fieldName);
    KiePMMLParameterField retrieved = KiePMMLParameterFieldInstanceFactory.getKiePMMLParameterField(toConvert);
    commonVerifyKiePMMLParameterField(retrieved, toConvert);
}
Also used : InstanceFactoriesTestCommon.commonVerifyKiePMMLParameterField(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLParameterField) KiePMMLParameterField(org.kie.pmml.commons.transformations.KiePMMLParameterField) PMMLModelTestUtils.getParameterField(org.kie.pmml.compiler.api.testutils.PMMLModelTestUtils.getParameterField) InstanceFactoriesTestCommon.commonVerifyKiePMMLParameterField(org.kie.pmml.compiler.commons.factories.InstanceFactoriesTestCommon.commonVerifyKiePMMLParameterField) KiePMMLParameterField(org.kie.pmml.commons.transformations.KiePMMLParameterField) ParameterField(org.dmg.pmml.ParameterField) Test(org.junit.Test)

Example 7 with KiePMMLParameterField

use of org.kie.pmml.commons.transformations.KiePMMLParameterField in project drools by kiegroup.

the class KiePMMLApplyTest method getDefineFunctionApplyFromFieldRef.

private KiePMMLDefineFunction getDefineFunctionApplyFromFieldRef() {
    // <DefineFunction name="CUSTOM_FUNCTION" optype="continuous" dataType="double">
    // <ParameterField name="PARAM_1"/>
    // <ParameterField field="PARAM_2"/>
    // <Apply function="/">
    // <Constant>100.0</Constant>
    // <FieldRef field="PARAM_2"/>
    // </Apply>
    // </DefineFunction>
    final KiePMMLConstant kiePMMLConstant1 = new KiePMMLConstant(PARAM_1, Collections.emptyList(), value1, null);
    final KiePMMLFieldRef kiePMMLFieldRef = new KiePMMLFieldRef(PARAM_2, Collections.emptyList(), null);
    KiePMMLApply kiePMMLApply = KiePMMLApply.builder("NAME", Collections.emptyList(), "/").withKiePMMLExpressions(Arrays.asList(kiePMMLConstant1, kiePMMLFieldRef)).build();
    final KiePMMLParameterField parameterField1 = KiePMMLParameterField.builder(PARAM_1, Collections.emptyList()).build();
    final KiePMMLParameterField parameterField2 = KiePMMLParameterField.builder(PARAM_2, Collections.emptyList()).build();
    return new KiePMMLDefineFunction(CUSTOM_FUNCTION, Collections.emptyList(), null, OP_TYPE.CONTINUOUS, Arrays.asList(parameterField1, parameterField2), kiePMMLApply);
}
Also used : KiePMMLDefineFunction(org.kie.pmml.commons.transformations.KiePMMLDefineFunction) KiePMMLParameterField(org.kie.pmml.commons.transformations.KiePMMLParameterField)

Example 8 with KiePMMLParameterField

use of org.kie.pmml.commons.transformations.KiePMMLParameterField in project drools by kiegroup.

the class KiePMMLApplyTest method getDefineFunctionApplyFromCustomFunction.

private KiePMMLDefineFunction getDefineFunctionApplyFromCustomFunction() {
    // <DefineFunction name="OUTER_FUNCTION" optype="continuous" dataType="double">
    // <ParameterField name="PARAM_1"/>
    // <ParameterField field="PARAM_2"/>
    // <Apply function="CUSTOM_FUNCTION">
    // <FieldRef field="PARAM_1"/>
    // <FieldRef field="PARAM_2"/>
    // </Apply>
    // </DefineFunction>
    final KiePMMLFieldRef kiePMMLFieldRef1 = new KiePMMLFieldRef(PARAM_1, Collections.emptyList(), null);
    final KiePMMLFieldRef kiePMMLFieldRef2 = new KiePMMLFieldRef(PARAM_2, Collections.emptyList(), null);
    KiePMMLApply kiePMMLApply = KiePMMLApply.builder("NAME", Collections.emptyList(), CUSTOM_FUNCTION).withKiePMMLExpressions(Arrays.asList(kiePMMLFieldRef1, kiePMMLFieldRef2)).build();
    final KiePMMLParameterField parameterField1 = KiePMMLParameterField.builder(PARAM_1, Collections.emptyList()).build();
    final KiePMMLParameterField parameterField2 = KiePMMLParameterField.builder(PARAM_2, Collections.emptyList()).build();
    return new KiePMMLDefineFunction(OUTER_FUNCTION, Collections.emptyList(), null, OP_TYPE.CONTINUOUS, Arrays.asList(parameterField1, parameterField2), kiePMMLApply);
}
Also used : KiePMMLDefineFunction(org.kie.pmml.commons.transformations.KiePMMLDefineFunction) KiePMMLParameterField(org.kie.pmml.commons.transformations.KiePMMLParameterField)

Aggregations

KiePMMLParameterField (org.kie.pmml.commons.transformations.KiePMMLParameterField)8 KiePMMLDefineFunction (org.kie.pmml.commons.transformations.KiePMMLDefineFunction)7 List (java.util.List)2 Optional (java.util.Optional)2 IntStream (java.util.stream.IntStream)2 ParameterField (org.dmg.pmml.ParameterField)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertTrue (org.junit.Assert.assertTrue)2 Test (org.junit.Test)2 DATA_TYPE (org.kie.pmml.api.enums.DATA_TYPE)2 OP_TYPE (org.kie.pmml.api.enums.OP_TYPE)2 ProcessingDTO (org.kie.pmml.commons.model.ProcessingDTO)2 KiePMMLApply (org.kie.pmml.commons.model.expressions.KiePMMLApply)2 KiePMMLConstant (org.kie.pmml.commons.model.expressions.KiePMMLConstant)2 KiePMMLFieldRef (org.kie.pmml.commons.model.expressions.KiePMMLFieldRef)2 KiePMMLTestingModel (org.kie.pmml.commons.testingutility.KiePMMLTestingModel)2 KiePMMLTransformationDictionary (org.kie.pmml.commons.transformations.KiePMMLTransformationDictionary)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1