use of org.kie.kogito.decision.DecisionModel in project kogito-apps by kiegroup.
the class LoanEligibilityDmnLimeExplainerTest method getModel.
private PredictionProvider getModel() {
DMNRuntime dmnRuntime = DMNKogito.createGenericDMNRuntime(new InputStreamReader(getClass().getResourceAsStream("/dmn/LoanEligibility.dmn")));
assertEquals(1, dmnRuntime.getModels().size());
final String FRAUD_NS = "https://github.com/kiegroup/kogito-examples/dmn-quarkus-listener-example";
final String FRAUD_NAME = "LoanEligibility";
DecisionModel decisionModel = new DmnDecisionModel(dmnRuntime, FRAUD_NS, FRAUD_NAME);
return new DecisionModelWrapper(decisionModel);
}
use of org.kie.kogito.decision.DecisionModel in project kogito-apps by kiegroup.
the class LoanEligibilityDmnPDPExplainerTest method testLoanEligibilityDMNExplanation.
@Test
void testLoanEligibilityDMNExplanation() throws ExecutionException, InterruptedException, TimeoutException {
DMNRuntime dmnRuntime = DMNKogito.createGenericDMNRuntime(new InputStreamReader(getClass().getResourceAsStream("/dmn/LoanEligibility.dmn")));
assertEquals(1, dmnRuntime.getModels().size());
final String FRAUD_NS = "https://github.com/kiegroup/kogito-examples/dmn-quarkus-listener-example";
final String FRAUD_NAME = "LoanEligibility";
DecisionModel decisionModel = new DmnDecisionModel(dmnRuntime, FRAUD_NS, FRAUD_NAME);
PredictionProvider model = new DecisionModelWrapper(decisionModel);
List<PredictionInput> inputs = DmnTestUtils.randomLoanEligibilityInputs();
List<PredictionOutput> predictionOutputs = model.predictAsync(inputs).get(Config.INSTANCE.getAsyncTimeout(), Config.INSTANCE.getAsyncTimeUnit());
List<Prediction> predictions = new ArrayList<>();
for (int i = 0; i < predictionOutputs.size(); i++) {
predictions.add(new SimplePrediction(inputs.get(i), predictionOutputs.get(i)));
}
PartialDependencePlotExplainer partialDependencePlotExplainer = new PartialDependencePlotExplainer();
List<PartialDependenceGraph> pdps = partialDependencePlotExplainer.explainFromPredictions(model, predictions);
assertThat(pdps).isNotNull();
Assertions.assertThat(pdps).hasSize(20);
}
use of org.kie.kogito.decision.DecisionModel in project kogito-apps by kiegroup.
the class PrequalificationDmnLimeExplainerTest method getModel.
private PredictionProvider getModel() {
DMNRuntime dmnRuntime = DMNKogito.createGenericDMNRuntime(new InputStreamReader(getClass().getResourceAsStream("/dmn/Prequalification-1.dmn")));
assertEquals(1, dmnRuntime.getModels().size());
final String NS = "http://www.trisotech.com/definitions/_f31e1f8e-d4ce-4a3a-ac3b-747efa6b3401";
final String NAME = "Prequalification";
DecisionModel decisionModel = new DmnDecisionModel(dmnRuntime, NS, NAME);
return new DecisionModelWrapper(decisionModel);
}
use of org.kie.kogito.decision.DecisionModel in project kogito-apps by kiegroup.
the class ComplexEligibilityDmnCounterfactualExplainerTest method getModel.
private PredictionProvider getModel() {
DMNRuntime dmnRuntime = DMNKogito.createGenericDMNRuntime(new InputStreamReader(getClass().getResourceAsStream("/dmn/ComplexEligibility.dmn")));
assertEquals(1, dmnRuntime.getModels().size());
final String COMPLEX_ELIGIBILITY_NS = "https://kiegroup.org/dmn/_B305FE71-3B8C-48C5-B5B1-D9CC04825B16";
final String COMPLEX_ELIGIBILITY_NAME = "myComplexEligibility";
DecisionModel decisionModel = new DmnDecisionModel(dmnRuntime, COMPLEX_ELIGIBILITY_NS, COMPLEX_ELIGIBILITY_NAME);
return new DecisionModelWrapper(decisionModel, List.of());
}
use of org.kie.kogito.decision.DecisionModel in project kogito-runtimes by kiegroup.
the class BaseSpringBootDecisionTracingTest method testSyncListenerAndCollectorWithRealEventsIsWorking.
@Test
void testSyncListenerAndCollectorWithRealEventsIsWorking() throws IOException {
final DMNRuntime runtime = buildDMNRuntime();
final DecisionModel model = buildDecisionModel(runtime);
final List<EvaluateEvent> events = testListener(false, runtime, model);
testCollector(events, model);
}
Aggregations