use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.
the class PMMLModelTestUtils method getRandomNormDiscrete.
public static NormDiscrete getRandomNormDiscrete() {
NormDiscrete toReturn = new NormDiscrete();
toReturn.setField(FieldName.create(RandomStringUtils.random(6, true, false)));
toReturn.setValue(getRandomObject(DataType.INTEGER));
toReturn.setMapMissingTo((Number) getRandomObject(DataType.INTEGER));
toReturn.setMethod(getRandomMethod());
return toReturn;
}
use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.
the class KiePMMLNormDiscreteFactoryTest method getNormDiscreteVariableDeclaration.
@Test
public void getNormDiscreteVariableDeclaration() throws IOException {
String variableName = "variableName";
String fieldName = "fieldName";
String fieldValue = "fieldValue";
double mapMissingTo = 45.32;
NormDiscrete normDiscrete = new NormDiscrete();
normDiscrete.setField(FieldName.create(fieldName));
normDiscrete.setValue(fieldValue);
normDiscrete.setMapMissingTo(mapMissingTo);
BlockStmt retrieved = KiePMMLNormDiscreteFactory.getNormDiscreteVariableDeclaration(variableName, normDiscrete);
String text = getFileContent(TEST_01_SOURCE);
Statement expected = JavaParserUtils.parseBlock(String.format(text, variableName, fieldName, fieldValue, mapMissingTo));
assertTrue(JavaParserUtils.equalsNode(expected, retrieved));
List<Class<?>> imports = Arrays.asList(Collections.class, KiePMMLNormDiscrete.class);
commonValidateCompilationWithImports(retrieved, imports);
}
use of org.dmg.pmml.NormDiscrete in project drools by kiegroup.
the class KiePMMLNormDiscreteInstanceFactoryTest method getKiePMMLNormDiscrete.
@Test
public void getKiePMMLNormDiscrete() {
NormDiscrete toConvert = getRandomNormDiscrete();
KiePMMLNormDiscrete retrieved = KiePMMLNormDiscreteInstanceFactory.getKiePMMLNormDiscrete(toConvert);
commonVerifyKiePMMLNormDiscrete(retrieved, toConvert);
}
Aggregations