use of org.kie.pmml.commons.model.expressions.KiePMMLApply in project drools by kiegroup.
the class KiePMMLDerivedFieldTest method evaluateFromApplyWithKiePMMLNameValues.
@Test
public void evaluateFromApplyWithKiePMMLNameValues() {
// <DerivedField name="CUSTOM_FIELD" optype="continuous" dataType="double">
// <Apply function="/">
// <FieldRef>PARAM_1</FieldRef>
// <FieldRef>PARAM_2</FieldRef>
// </Apply>
// </DerivedField>
final KiePMMLFieldRef kiePMMLFieldRef1 = new KiePMMLFieldRef(PARAM_1, Collections.emptyList(), null);
final KiePMMLFieldRef kiePMMLFieldRef2 = new KiePMMLFieldRef(PARAM_2, Collections.emptyList(), null);
final KiePMMLApply kiePMMLApply = KiePMMLApply.builder("NAME", Collections.emptyList(), "/").withKiePMMLExpressions(Arrays.asList(kiePMMLFieldRef1, kiePMMLFieldRef2)).build();
final KiePMMLDerivedField derivedField = KiePMMLDerivedField.builder(CUSTOM_FIELD, Collections.emptyList(), DATA_TYPE.DOUBLE, OP_TYPE.CONTINUOUS, kiePMMLApply).build();
ProcessingDTO processingDTO = getProcessingDTO(Collections.emptyList(), getKiePMMLNameValues());
Object retrieved = derivedField.evaluate(processingDTO);
Object expected = value1 / value2;
assertEquals(expected, retrieved);
}
use of org.kie.pmml.commons.model.expressions.KiePMMLApply in project drools by kiegroup.
the class KiePMMLAttributeTest method getKiePMMLComplexPartialScore.
private KiePMMLComplexPartialScore getKiePMMLComplexPartialScore() {
// <ComplexPartialScore>
// <Apply function="/">
// <FieldRef>PARAM_1</FieldRef>
// <FieldRef>PARAM_2</FieldRef>
// </Apply>
// </ComplexPartialScore>
final KiePMMLFieldRef kiePMMLFieldRef1 = new KiePMMLFieldRef(PARAM_1, Collections.emptyList(), null);
final KiePMMLFieldRef kiePMMLFieldRef2 = new KiePMMLFieldRef(PARAM_2, Collections.emptyList(), null);
final KiePMMLApply kiePMMLApply = KiePMMLApply.builder("NAME", Collections.emptyList(), "/").withKiePMMLExpressions(Arrays.asList(kiePMMLFieldRef1, kiePMMLFieldRef2)).build();
return new KiePMMLComplexPartialScore(CUSTOM_FIELD, Collections.emptyList(), kiePMMLApply);
}
Aggregations