use of org.kie.pmml.commons.model.tuples.KiePMMLNameValue in project drools by kiegroup.
the class MULTIPLE_MODEL_METHODTest method applyMEDIANNotNumbers.
@Test(expected = KieEnumException.class)
public void applyMEDIANNotNumbers() {
LinkedHashMap<String, KiePMMLNameValue> inputData = new LinkedHashMap<>();
Object EXPECTED = "EXPECTED";
inputData.put("ValueA", new KiePMMLNameValue("valuea", "dvsdv"));
inputData.put("ValueB", new KiePMMLNameValue("valueb", EXPECTED));
inputData.put("ValueC", new KiePMMLNameValue("valuec", "dssd"));
inputData.put("ValueD", new KiePMMLNameValue("valuex", EXPECTED));
inputData.put("ValueE", new KiePMMLNameValue("valueb", "vsd"));
MEDIAN.applyPrediction(inputData);
}
use of org.kie.pmml.commons.model.tuples.KiePMMLNameValue in project drools by kiegroup.
the class MULTIPLE_MODEL_METHODTest method applySELECT_ALLNotNumbers.
@Test
public void applySELECT_ALLNotNumbers() {
LinkedHashMap<String, KiePMMLNameValue> inputData = new LinkedHashMap<>();
inputData.put("ValueA", new KiePMMLNameValue("valuea", "fvdsfsdfsd"));
inputData.put("ValueB", new KiePMMLNameValue("valueb", "vdsvsd"));
inputData.put("ValueC", new KiePMMLNameValue("valuec", "dssd"));
inputData.put("ValueD", new KiePMMLNameValue("valuex", "vfdsvsdeeee"));
inputData.put("ValueE", new KiePMMLNameValue("valueb", "vsd"));
List expected = inputData.values().stream().map(KiePMMLNameValue::getValue).collect(Collectors.toList());
List retrieved = (List) SELECT_ALL.applyPrediction(inputData);
assertEquals(expected.size(), retrieved.size());
expected.forEach(expString -> assertTrue(retrieved.contains(expString)));
}
use of org.kie.pmml.commons.model.tuples.KiePMMLNameValue in project drools by kiegroup.
the class MULTIPLE_MODEL_METHODTest method applySUMNotNumbers.
@Test(expected = KieEnumException.class)
public void applySUMNotNumbers() {
LinkedHashMap<String, KiePMMLNameValue> inputData = new LinkedHashMap<>();
Object EXPECTED = "EXPECTED";
inputData.put("ValueA", new KiePMMLNameValue("valuea", "dvsdv"));
inputData.put("ValueB", new KiePMMLNameValue("valueb", EXPECTED));
inputData.put("ValueC", new KiePMMLNameValue("valuec", "dssd"));
inputData.put("ValueD", new KiePMMLNameValue("valuex", EXPECTED));
inputData.put("ValueE", new KiePMMLNameValue("valueb", "vsd"));
SUM.applyPrediction(inputData);
}
use of org.kie.pmml.commons.model.tuples.KiePMMLNameValue in project drools by kiegroup.
the class MULTIPLE_MODEL_METHODTest method applyWEIGHTED_MEDIANNotNumbers.
@Test(expected = KieEnumException.class)
public void applyWEIGHTED_MEDIANNotNumbers() {
LinkedHashMap<String, KiePMMLNameValue> inputData = new LinkedHashMap<>();
Object EXPECTED = "EXPECTED";
inputData.put("ValueA", new KiePMMLNameValue("valuea", "dvsdv"));
inputData.put("ValueB", new KiePMMLNameValue("valueb", EXPECTED));
inputData.put("ValueC", new KiePMMLNameValue("valuec", "dssd"));
inputData.put("ValueD", new KiePMMLNameValue("valuex", EXPECTED));
inputData.put("ValueE", new KiePMMLNameValue("valueb", "vsd"));
WEIGHTED_MEDIAN.applyPrediction(inputData);
}
use of org.kie.pmml.commons.model.tuples.KiePMMLNameValue in project drools by kiegroup.
the class KiePMMLOutputFieldTest method evaluateTransformedValueFromFieldRef.
@Test
public void evaluateTransformedValueFromFieldRef() {
// <OutputField name="CUSTOM_FIELD" optype="continuous" dataType="double" feature="transformedValue">
// <FieldRef field="PARAM_1"/>
// </OutputField>
final KiePMMLFieldRef kiePMMLFieldRef = new KiePMMLFieldRef(PARAM_1, Collections.emptyList(), null);
final KiePMMLOutputField outputField = KiePMMLOutputField.builder(CUSTOM_FIELD, Collections.emptyList()).withKiePMMLExpression(kiePMMLFieldRef).withResultFeature(RESULT_FEATURE.TRANSFORMED_VALUE).build();
ProcessingDTO processingDTO = getProcessingDTO(Collections.emptyList(), Arrays.asList(new KiePMMLNameValue(PARAM_1, value1)), Collections.emptyList());
Object retrieved = outputField.evaluate(processingDTO);
assertEquals(value1, retrieved);
}
Aggregations