use of org.kie.api.pmml.PMMLRequestData in project drools by kiegroup.
the class PreProcessTest method verifyAddMissingValuesMissingReturnInvalid.
@Test(expected = KiePMMLException.class)
public void verifyAddMissingValuesMissingReturnInvalid() {
List<KiePMMLMiningField> miningFields = IntStream.range(0, 3).mapToObj(i -> {
DATA_TYPE dataType = DATA_TYPE.values()[i];
return KiePMMLMiningField.builder("FIELD-" + i, null).withDataType(dataType).withMissingValueTreatmentMethod(MISSING_VALUE_TREATMENT_METHOD.RETURN_INVALID).build();
}).collect(Collectors.toList());
PMMLRequestData pmmlRequestData = new PMMLRequestData("123", "modelName");
PreProcess.verifyAddMissingValues(miningFields, pmmlRequestData);
}
use of org.kie.api.pmml.PMMLRequestData in project drools by kiegroup.
the class PMMLListenerUtilsTest method stepNotExecuted.
@Test
public void stepNotExecuted() {
PMMLContext pmmlContext = new PMMLContextImpl(new PMMLRequestData());
AtomicBoolean invoked = new AtomicBoolean(false);
PMMLListenerUtils.stepExecuted(() -> new PMMLStepTest(invoked), pmmlContext);
assertFalse(invoked.get());
}
use of org.kie.api.pmml.PMMLRequestData in project drools by kiegroup.
the class CategoricalBatchBenchmark method readCSV.
private static PMMLContext readCSV(String line) {
if (line.startsWith("Age")) {
return null;
}
final String[] split = line.split(",");
PMMLRequestData pmmlRequestData = new PMMLRequestData("123", MODEL_NAME);
pmmlRequestData.addRequestParam("Age", Integer.valueOf(split[0]));
pmmlRequestData.addRequestParam("Employment", split[1]);
pmmlRequestData.addRequestParam("Education", split[2]);
pmmlRequestData.addRequestParam("Marital", split[3]);
pmmlRequestData.addRequestParam("Occupation", split[4]);
pmmlRequestData.addRequestParam("Income", Double.valueOf(split[5]));
pmmlRequestData.addRequestParam("Gender", split[6]);
pmmlRequestData.addRequestParam("Hours", Integer.valueOf(split[8]));
return new PMMLContextImpl(pmmlRequestData);
}
use of org.kie.api.pmml.PMMLRequestData in project drools by kiegroup.
the class CategoricalBenchmark method setupModel.
@Setup
public void setupModel() throws Exception {
logger.debug("setup model...");
modelName = "Sample for logistic regression";
fileName = "CategoricalRegressionSample.pmml";
super.setupModel();
logger.debug("setup pmmlContext...");
PMMLRequestData pmmlRequestData = new PMMLRequestData("123", modelName);
pmmlRequestData.addRequestParam("age", 22);
pmmlRequestData.addRequestParam("work", 3);
pmmlRequestData.addRequestParam("sex", "0");
pmmlRequestData.addRequestParam("minority", "1");
pmmlContext = new PMMLContextImpl(pmmlRequestData);
}
use of org.kie.api.pmml.PMMLRequestData in project drools by kiegroup.
the class RegressionBenchmark method setupModel.
@Setup
public void setupModel() throws Exception {
logger.debug("setup model...");
modelName = "Sample for linear regression";
fileName = "LinearRegressionSample.pmml";
super.setupModel();
logger.debug("setup pmmlContext...");
PMMLRequestData pmmlRequestData = new PMMLRequestData("123", modelName);
pmmlRequestData.addRequestParam("age", 22);
pmmlRequestData.addRequestParam("salary", 2345.43);
pmmlRequestData.addRequestParam("car_location", "carpark");
pmmlContext = new PMMLContextImpl(pmmlRequestData);
}
Aggregations