Search in sources :

Example 1 with PMMLModelEvaluator

use of org.kie.pmml.evaluator.core.executor.PMMLModelEvaluator in project drools by kiegroup.

the class PMMLRuntimeInternalImpl method evaluate.

@SuppressWarnings({ "unchecked", "rawtypes" })
protected PMML4Result evaluate(final KiePMMLModel model, final PMMLContext context) {
    if (logger.isDebugEnabled()) {
        logger.debug("evaluate {} {}", model, context);
    }
    pmmlListeners.forEach(context::addPMMLListener);
    addStep(() -> getStep(START, model, context.getRequestData()), context);
    final ProcessingDTO processingDTO = preProcess(model, context);
    addStep(() -> getStep(PRE_EVALUATION, model, context.getRequestData()), context);
    PMMLModelEvaluator executor = getFromPMMLModelType(model.getPmmlMODEL()).orElseThrow(() -> new KiePMMLException(String.format("PMMLModelEvaluator not found for model %s", model.getPmmlMODEL())));
    PMML4Result toReturn = executor.evaluate(knowledgeBase, model, context);
    addStep(() -> getStep(POST_EVALUATION, model, context.getRequestData()), context);
    postProcess(toReturn, model, context, processingDTO);
    addStep(() -> getStep(END, model, context.getRequestData()), context);
    return toReturn;
}
Also used : ProcessingDTO(org.kie.pmml.commons.model.ProcessingDTO) PMML4Result(org.kie.api.pmml.PMML4Result) PMMLModelEvaluator(org.kie.pmml.evaluator.core.executor.PMMLModelEvaluator) KiePMMLException(org.kie.pmml.api.exceptions.KiePMMLException)

Aggregations

PMML4Result (org.kie.api.pmml.PMML4Result)1 KiePMMLException (org.kie.pmml.api.exceptions.KiePMMLException)1 ProcessingDTO (org.kie.pmml.commons.model.ProcessingDTO)1 PMMLModelEvaluator (org.kie.pmml.evaluator.core.executor.PMMLModelEvaluator)1