Search in sources :

Example 26 with NamedTypedValue

use of org.kie.kogito.explainability.api.NamedTypedValue in project kogito-apps by kiegroup.

the class ExplainabilityApiV1IT method testCounterfactualRequestWithStructuredModel.

@Test
@SuppressWarnings("unchecked")
void testCounterfactualRequestWithStructuredModel() {
    ArgumentCaptor<List<NamedTypedValue>> goalsCaptor = ArgumentCaptor.forClass(List.class);
    ArgumentCaptor<List<CounterfactualSearchDomain>> searchDomainsCaptor = ArgumentCaptor.forClass(List.class);
    mockServiceWithCounterfactualRequest();
    CounterfactualRequestResponse response = given().filter(new RequestLoggingFilter()).filter(new ResponseLoggingFilter()).contentType(MediaType.APPLICATION_JSON).body(getCounterfactualWithStructuredModelJsonRequest()).when().post("/executions/decisions/" + TEST_EXECUTION_ID + "/explanations/counterfactuals").as(CounterfactualRequestResponse.class);
    assertNotNull(response);
    assertNotNull(response.getExecutionId());
    assertNotNull(response.getCounterfactualId());
    assertEquals(response.getExecutionId(), TEST_EXECUTION_ID);
    assertEquals(response.getCounterfactualId(), TEST_COUNTERFACTUAL_ID);
    verify(executionService).requestCounterfactuals(eq(TEST_EXECUTION_ID), goalsCaptor.capture(), searchDomainsCaptor.capture());
    List<NamedTypedValue> goalsParameter = goalsCaptor.getValue();
    assertNotNull(goalsParameter);
    assertEquals(1, goalsParameter.size());
    NamedTypedValue goal1 = goalsParameter.get(0);
    assertEquals(TypedValue.Kind.STRUCTURE, goal1.getValue().getKind());
    assertEquals("Fine", goal1.getName());
    assertEquals("tFine", goal1.getValue().getType());
    assertEquals(2, goal1.getValue().toStructure().getValue().size());
    Iterator<Map.Entry<String, TypedValue>> goal1ChildIterator = goal1.getValue().toStructure().getValue().entrySet().iterator();
    Map.Entry<String, TypedValue> goal1Child1 = goal1ChildIterator.next();
    Map.Entry<String, TypedValue> goal1Child2 = goal1ChildIterator.next();
    assertEquals(TypedValue.Kind.UNIT, goal1Child1.getValue().getKind());
    assertEquals("Amount", goal1Child1.getKey());
    assertEquals("number", goal1Child1.getValue().getType());
    assertEquals(100, goal1Child1.getValue().toUnit().getValue().asInt());
    assertEquals(TypedValue.Kind.UNIT, goal1Child2.getValue().getKind());
    assertEquals("Points", goal1Child2.getKey());
    assertEquals("number", goal1Child2.getValue().getType());
    assertEquals(0, goal1Child2.getValue().toUnit().getValue().asInt());
    List<CounterfactualSearchDomain> searchDomainsParameter = searchDomainsCaptor.getValue();
    assertNotNull(searchDomainsParameter);
    assertEquals(1, searchDomainsParameter.size());
    CounterfactualSearchDomain domain1 = searchDomainsParameter.get(0);
    assertEquals(TypedValue.Kind.STRUCTURE, domain1.getValue().getKind());
    assertEquals("Violation", domain1.getName());
    assertEquals("tViolation", domain1.getValue().getType());
    assertEquals(3, domain1.getValue().toStructure().getValue().size());
    Iterator<Map.Entry<String, CounterfactualSearchDomainValue>> domain1ChildIterator = domain1.getValue().toStructure().getValue().entrySet().iterator();
    Map.Entry<String, CounterfactualSearchDomainValue> domain1Child1 = domain1ChildIterator.next();
    Map.Entry<String, CounterfactualSearchDomainValue> domain1Child2 = domain1ChildIterator.next();
    Map.Entry<String, CounterfactualSearchDomainValue> domain1Child3 = domain1ChildIterator.next();
    assertEquals(TypedValue.Kind.UNIT, domain1Child1.getValue().getKind());
    assertFalse(domain1Child1.getValue().toUnit().isFixed());
    assertEquals("Type", domain1Child1.getKey());
    assertEquals("string", domain1Child1.getValue().getType());
    assertNotNull(domain1Child1.getValue().toUnit().getDomain());
    assertTrue(domain1Child1.getValue().toUnit().getDomain() instanceof CounterfactualDomainCategorical);
    CounterfactualDomainCategorical domain1Child1Def = (CounterfactualDomainCategorical) domain1Child1.getValue().toUnit().getDomain();
    assertEquals(2, domain1Child1Def.getCategories().size());
    assertTrue(domain1Child1Def.getCategories().stream().map(JsonNode::asText).collect(Collectors.toList()).containsAll(Arrays.asList("speed", "driving under the influence")));
    assertEquals(TypedValue.Kind.UNIT, domain1Child2.getValue().getKind());
    assertFalse(domain1Child2.getValue().toUnit().isFixed());
    assertEquals("Actual Speed", domain1Child2.getKey());
    assertEquals("number", domain1Child2.getValue().getType());
    assertNotNull(domain1Child2.getValue().toUnit().getDomain());
    assertTrue(domain1Child2.getValue().toUnit().getDomain() instanceof CounterfactualDomainRange);
    CounterfactualDomainRange domain1Child2Def = (CounterfactualDomainRange) domain1Child2.getValue().toUnit().getDomain();
    assertEquals(0, domain1Child2Def.getLowerBound().asInt());
    assertEquals(100, domain1Child2Def.getUpperBound().asInt());
    assertEquals(TypedValue.Kind.UNIT, domain1Child3.getValue().getKind());
    assertFalse(domain1Child3.getValue().toUnit().isFixed());
    assertEquals("Speed Limit", domain1Child3.getKey());
    assertEquals("number", domain1Child3.getValue().getType());
    assertNotNull(domain1Child3.getValue().toUnit().getDomain());
    assertTrue(domain1Child3.getValue().toUnit().getDomain() instanceof CounterfactualDomainRange);
    CounterfactualDomainRange domain1Child3Def = (CounterfactualDomainRange) domain1Child3.getValue().toUnit().getDomain();
    assertEquals(0, domain1Child3Def.getLowerBound().asInt());
    assertEquals(100, domain1Child3Def.getUpperBound().asInt());
}
Also used : CounterfactualDomainRange(org.kie.kogito.explainability.api.CounterfactualDomainRange) CounterfactualDomainCategorical(org.kie.kogito.explainability.api.CounterfactualDomainCategorical) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ResponseLoggingFilter(io.restassured.filter.log.ResponseLoggingFilter) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) List(java.util.List) ArrayList(java.util.ArrayList) RequestLoggingFilter(io.restassured.filter.log.RequestLoggingFilter) CounterfactualRequestResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualRequestResponse) Map(java.util.Map) CounterfactualSearchDomainValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainValue) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) TypedValue(org.kie.kogito.tracing.typedvalue.TypedValue) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 27 with NamedTypedValue

use of org.kie.kogito.explainability.api.NamedTypedValue in project kogito-apps by kiegroup.

the class ExplainabilityApiV1IT method testCounterfactualRequest.

@Test
@SuppressWarnings("unchecked")
void testCounterfactualRequest() {
    ArgumentCaptor<List<NamedTypedValue>> goalsCaptor = ArgumentCaptor.forClass(List.class);
    ArgumentCaptor<List<CounterfactualSearchDomain>> searchDomainsCaptor = ArgumentCaptor.forClass(List.class);
    mockServiceWithCounterfactualRequest();
    CounterfactualRequestResponse response = given().filter(new RequestLoggingFilter()).filter(new ResponseLoggingFilter()).contentType(MediaType.APPLICATION_JSON).body(getCounterfactualJsonRequest()).when().post("/executions/decisions/" + TEST_EXECUTION_ID + "/explanations/counterfactuals").as(CounterfactualRequestResponse.class);
    assertNotNull(response);
    assertNotNull(response.getExecutionId());
    assertNotNull(response.getCounterfactualId());
    assertEquals(response.getExecutionId(), TEST_EXECUTION_ID);
    assertEquals(response.getCounterfactualId(), TEST_COUNTERFACTUAL_ID);
    verify(executionService).requestCounterfactuals(eq(TEST_EXECUTION_ID), goalsCaptor.capture(), searchDomainsCaptor.capture());
    List<NamedTypedValue> goalsParameter = goalsCaptor.getValue();
    assertNotNull(goalsParameter);
    assertEquals(2, goalsParameter.size());
    NamedTypedValue goal1 = goalsParameter.get(0);
    assertEquals(TypedValue.Kind.UNIT, goal1.getValue().getKind());
    assertEquals("deposit", goal1.getName());
    assertEquals("number", goal1.getValue().getType());
    assertEquals(5000, goal1.getValue().toUnit().getValue().asInt());
    NamedTypedValue goal2 = goalsParameter.get(1);
    assertEquals(TypedValue.Kind.UNIT, goal2.getValue().getKind());
    assertEquals("approved", goal2.getName());
    assertEquals("boolean", goal2.getValue().getType());
    assertEquals(Boolean.TRUE, goal2.getValue().toUnit().getValue().asBoolean());
    List<CounterfactualSearchDomain> searchDomainsParameter = searchDomainsCaptor.getValue();
    assertNotNull(searchDomainsParameter);
    assertEquals(3, searchDomainsParameter.size());
    CounterfactualSearchDomain domain1 = searchDomainsParameter.get(0);
    assertEquals(TypedValue.Kind.UNIT, domain1.getValue().getKind());
    assertTrue(domain1.getValue().toUnit().isFixed());
    assertEquals("age", domain1.getName());
    assertEquals("number", domain1.getValue().getType());
    assertNull(domain1.getValue().toUnit().getDomain());
    CounterfactualSearchDomain domain2 = searchDomainsParameter.get(1);
    assertEquals(TypedValue.Kind.UNIT, domain2.getValue().getKind());
    assertFalse(domain2.getValue().toUnit().isFixed());
    assertEquals("income", domain2.getName());
    assertEquals("number", domain2.getValue().getType());
    assertNotNull(domain2.getValue().toUnit().getDomain());
    assertTrue(domain2.getValue().toUnit().getDomain() instanceof CounterfactualDomainRange);
    CounterfactualDomainRange domain2Def = (CounterfactualDomainRange) domain2.getValue().toUnit().getDomain();
    assertEquals(0, domain2Def.getLowerBound().asInt());
    assertEquals(1000, domain2Def.getUpperBound().asInt());
    CounterfactualSearchDomain domain3 = searchDomainsParameter.get(2);
    assertEquals(TypedValue.Kind.UNIT, domain3.getValue().getKind());
    assertFalse(domain3.getValue().toUnit().isFixed());
    assertEquals("taxCode", domain3.getName());
    assertEquals("string", domain3.getValue().getType());
    assertNotNull(domain3.getValue().toUnit().getDomain());
    assertTrue(domain3.getValue().toUnit().getDomain() instanceof CounterfactualDomainCategorical);
    CounterfactualDomainCategorical domain3Def = (CounterfactualDomainCategorical) domain3.getValue().toUnit().getDomain();
    assertEquals(3, domain3Def.getCategories().size());
    assertTrue(domain3Def.getCategories().stream().map(JsonNode::asText).collect(Collectors.toList()).containsAll(Arrays.asList("A", "B", "C")));
}
Also used : NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) CounterfactualDomainRange(org.kie.kogito.explainability.api.CounterfactualDomainRange) List(java.util.List) ArrayList(java.util.ArrayList) RequestLoggingFilter(io.restassured.filter.log.RequestLoggingFilter) CounterfactualDomainCategorical(org.kie.kogito.explainability.api.CounterfactualDomainCategorical) ResponseLoggingFilter(io.restassured.filter.log.ResponseLoggingFilter) CounterfactualRequestResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualRequestResponse) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 28 with NamedTypedValue

use of org.kie.kogito.explainability.api.NamedTypedValue in project kogito-apps by kiegroup.

the class ExplainabilityApiV1Test method testGetCounterfactualResultsWhenExecutionDoesExistAndResultsHaveBeenCreated.

@Test
public void testGetCounterfactualResultsWhenExecutionDoesExistAndResultsHaveBeenCreated() {
    NamedTypedValue goal = buildGoalUnit("unit", "string", new TextNode("hello"));
    CounterfactualSearchDomain searchDomain = buildSearchDomainUnit("unit", "string", new CounterfactualDomainCategorical(List.of(new TextNode("hello"), new TextNode("goodbye"))));
    CounterfactualExplainabilityResult solution1 = new CounterfactualExplainabilityResult(EXECUTION_ID, COUNTERFACTUAL_ID, "solution1", 0L, ExplainabilityStatus.SUCCEEDED, "", true, CounterfactualExplainabilityResult.Stage.INTERMEDIATE, Collections.emptyList(), Collections.emptyList());
    CounterfactualExplainabilityResult solution2 = new CounterfactualExplainabilityResult(EXECUTION_ID, COUNTERFACTUAL_ID, "solution2", 1L, ExplainabilityStatus.SUCCEEDED, "", true, CounterfactualExplainabilityResult.Stage.FINAL, Collections.emptyList(), Collections.emptyList());
    when(trustyService.getCounterfactualRequest(anyString(), anyString())).thenReturn(new CounterfactualExplainabilityRequest(EXECUTION_ID, SERVICE_URL, new ModelIdentifier("resourceType", "resourceIdentifier"), COUNTERFACTUAL_ID, Collections.emptyList(), List.of(goal), List.of(searchDomain), MAX_RUNNING_TIME_SECONDS));
    when(trustyService.getCounterfactualResults(anyString(), anyString())).thenReturn(List.of(solution1, solution2));
    Response response = explainabilityEndpoint.getCounterfactualDetails(EXECUTION_ID, COUNTERFACTUAL_ID);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    Object entity = response.getEntity();
    assertNotNull(entity);
    assertTrue(entity instanceof CounterfactualResultsResponse);
    CounterfactualResultsResponse resultsResponse = (CounterfactualResultsResponse) entity;
    assertEquals(EXECUTION_ID, resultsResponse.getExecutionId());
    assertEquals(COUNTERFACTUAL_ID, resultsResponse.getCounterfactualId());
    assertEquals(MAX_RUNNING_TIME_SECONDS, resultsResponse.getMaxRunningTimeSeconds());
    assertEquals(1, resultsResponse.getGoals().size());
    assertEquals(goal, resultsResponse.getGoals().iterator().next());
    assertEquals(1, resultsResponse.getSearchDomains().size());
    assertEquals(searchDomain, resultsResponse.getSearchDomains().iterator().next());
    assertEquals(2, resultsResponse.getSolutions().size());
    assertEquals(solution1, resultsResponse.getSolutions().get(0));
    assertEquals(solution2, resultsResponse.getSolutions().get(1));
}
Also used : CounterfactualExplainabilityRequest(org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest) CounterfactualRequestResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualRequestResponse) Response(javax.ws.rs.core.Response) CounterfactualResultsResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualResultsResponse) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) ModelIdentifier(org.kie.kogito.explainability.api.ModelIdentifier) TextNode(com.fasterxml.jackson.databind.node.TextNode) CounterfactualDomainCategorical(org.kie.kogito.explainability.api.CounterfactualDomainCategorical) CounterfactualExplainabilityResult(org.kie.kogito.explainability.api.CounterfactualExplainabilityResult) CounterfactualResultsResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualResultsResponse) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) Test(org.junit.jupiter.api.Test)

Example 29 with NamedTypedValue

use of org.kie.kogito.explainability.api.NamedTypedValue in project kogito-apps by kiegroup.

the class ExplainabilityApiV1Test method testGetCounterfactualResultsWhenExecutionDoesExist.

@Test
public void testGetCounterfactualResultsWhenExecutionDoesExist() {
    NamedTypedValue goal = buildGoalUnit("unit", "string", new TextNode("hello"));
    CounterfactualSearchDomain searchDomain = buildSearchDomainUnit("unit", "string", new CounterfactualDomainCategorical(List.of(new TextNode("hello"), new TextNode("goodbye"))));
    when(trustyService.getCounterfactualRequest(anyString(), anyString())).thenReturn(new CounterfactualExplainabilityRequest(EXECUTION_ID, SERVICE_URL, new ModelIdentifier("resourceType", "resourceIdentifier"), COUNTERFACTUAL_ID, Collections.emptyList(), List.of(goal), List.of(searchDomain), MAX_RUNNING_TIME_SECONDS));
    Response response = explainabilityEndpoint.getCounterfactualDetails(EXECUTION_ID, COUNTERFACTUAL_ID);
    assertNotNull(response);
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    Object entity = response.getEntity();
    assertNotNull(entity);
    assertTrue(entity instanceof CounterfactualResultsResponse);
    CounterfactualResultsResponse resultsResponse = (CounterfactualResultsResponse) entity;
    assertEquals(EXECUTION_ID, resultsResponse.getExecutionId());
    assertEquals(COUNTERFACTUAL_ID, resultsResponse.getCounterfactualId());
    assertEquals(MAX_RUNNING_TIME_SECONDS, resultsResponse.getMaxRunningTimeSeconds());
    assertEquals(1, resultsResponse.getGoals().size());
    assertEquals(goal, resultsResponse.getGoals().iterator().next());
    assertEquals(1, resultsResponse.getSearchDomains().size());
    assertEquals(searchDomain, resultsResponse.getSearchDomains().iterator().next());
    assertTrue(resultsResponse.getSolutions().isEmpty());
}
Also used : CounterfactualExplainabilityRequest(org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest) CounterfactualRequestResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualRequestResponse) Response(javax.ws.rs.core.Response) CounterfactualResultsResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualResultsResponse) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) ModelIdentifier(org.kie.kogito.explainability.api.ModelIdentifier) TextNode(com.fasterxml.jackson.databind.node.TextNode) CounterfactualDomainCategorical(org.kie.kogito.explainability.api.CounterfactualDomainCategorical) CounterfactualResultsResponse(org.kie.kogito.trusty.service.common.responses.CounterfactualResultsResponse) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) Test(org.junit.jupiter.api.Test)

Example 30 with NamedTypedValue

use of org.kie.kogito.explainability.api.NamedTypedValue in project kogito-apps by kiegroup.

the class TrustyServiceTest method givenStoredExecutionWhenCounterfactualRequestIsMadeThenExplainabilityEventHasCorrectPayload.

@Test
@SuppressWarnings("unchecked")
void givenStoredExecutionWhenCounterfactualRequestIsMadeThenExplainabilityEventHasCorrectPayload() {
    Storage<String, Decision> decisionStorage = mock(Storage.class);
    Storage<String, CounterfactualExplainabilityRequest> counterfactualStorage = mock(Storage.class);
    ArgumentCaptor<BaseExplainabilityRequest> explainabilityEventArgumentCaptor = ArgumentCaptor.forClass(BaseExplainabilityRequest.class);
    Decision decision = new Decision(TEST_EXECUTION_ID, TEST_SOURCE_URL, TEST_SERVICE_URL, 0L, true, null, "model", "modelNamespace", List.of(new DecisionInput("IN1", "yearsOfService", new UnitValue("integer", "integer", new IntNode(10)))), List.of(new DecisionOutcome("OUT1", "salary", "SUCCEEDED", new UnitValue("integer", "integer", new IntNode(1000)), Collections.emptyList(), Collections.emptyList())));
    when(decisionStorage.containsKey(eq(TEST_EXECUTION_ID))).thenReturn(true);
    when(trustyStorageServiceMock.getDecisionsStorage()).thenReturn(decisionStorage);
    when(trustyStorageServiceMock.getCounterfactualRequestStorage()).thenReturn(counterfactualStorage);
    when(decisionStorage.get(eq(TEST_EXECUTION_ID))).thenReturn(decision);
    trustyService.requestCounterfactuals(TEST_EXECUTION_ID, List.of(new NamedTypedValue("salary", new UnitValue("integer", "integer", new IntNode(2000)))), List.of(new CounterfactualSearchDomain("yearsOfService", new CounterfactualSearchDomainUnitValue("integer", "integer", false, new CounterfactualDomainRange(new IntNode(10), new IntNode(30))))));
    verify(explainabilityRequestProducerMock).sendEvent(explainabilityEventArgumentCaptor.capture());
    BaseExplainabilityRequest event = explainabilityEventArgumentCaptor.getValue();
    CounterfactualExplainabilityRequest request = (CounterfactualExplainabilityRequest) event;
    assertEquals(TEST_EXECUTION_ID, request.getExecutionId());
    assertEquals(TEST_SERVICE_URL, request.getServiceUrl());
    // Check original input value has been copied into CF request
    assertEquals(1, request.getOriginalInputs().size());
    assertTrue(request.getOriginalInputs().stream().anyMatch(i -> i.getName().equals("yearsOfService")));
    // It is safe to use the iterator unchecked as the collection only contains one item
    assertEquals(decision.getInputs().iterator().next().getValue().toUnit().getValue().asInt(), request.getOriginalInputs().iterator().next().getValue().toUnit().getValue().asInt());
    // Check CF goals have been copied into CF request
    assertEquals(1, request.getGoals().size());
    assertTrue(request.getGoals().stream().anyMatch(g -> g.getName().equals("salary")));
    // It is safe to use the iterator unchecked as the collection only contains one item
    assertEquals(2000, request.getGoals().iterator().next().getValue().toUnit().getValue().asInt());
    // Check CF search domains have been copied into CF request
    assertEquals(1, request.getSearchDomains().size());
    assertTrue(request.getSearchDomains().stream().anyMatch(sd -> sd.getName().equals("yearsOfService")));
    // It is safe to use the iterator unchecked as the collection only contains one item
    CounterfactualSearchDomainValue searchDomain = request.getSearchDomains().iterator().next().getValue();
    assertTrue(searchDomain instanceof CounterfactualSearchDomainUnitValue);
    CounterfactualSearchDomainUnitValue unit = (CounterfactualSearchDomainUnitValue) searchDomain;
    assertFalse(unit.isFixed());
    assertNotNull(unit.getDomain());
    assertTrue(unit.getDomain() instanceof CounterfactualDomainRange);
    CounterfactualDomainRange range = (CounterfactualDomainRange) unit.getDomain();
    assertEquals(10, range.getLowerBound().asInt());
    assertEquals(30, range.getUpperBound().asInt());
    // Check Max Running Time Seconds
    assertEquals(MAX_RUNNING_TIME_SECONDS, request.getMaxRunningTimeSeconds());
}
Also used : CounterfactualExplainabilityRequest(org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest) DecisionInput(org.kie.kogito.trusty.storage.api.model.decision.DecisionInput) BeforeEach(org.junit.jupiter.api.BeforeEach) LIMEExplainabilityResult(org.kie.kogito.explainability.api.LIMEExplainabilityResult) BaseExplainabilityRequest(org.kie.kogito.explainability.api.BaseExplainabilityRequest) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) CounterfactualSearchDomainValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainValue) CounterfactualDomainRange(org.kie.kogito.explainability.api.CounterfactualDomainRange) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) CounterfactualExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainerServiceHandler) Map(java.util.Map) CounterfactualExplainabilityResultsManagerSlidingWindow(org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainabilityResultsManagerSlidingWindow) JsonNode(com.fasterxml.jackson.databind.JsonNode) Instance(javax.enterprise.inject.Instance) CounterfactualExplainabilityResultsManagerDuplicates(org.kie.kogito.trusty.service.common.handlers.CounterfactualExplainabilityResultsManagerDuplicates) CounterfactualExplainabilityRequest(org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) ExplainabilityStatus(org.kie.kogito.explainability.api.ExplainabilityStatus) UUID(java.util.UUID) TextNode(com.fasterxml.jackson.databind.node.TextNode) UnitValue(org.kie.kogito.tracing.typedvalue.UnitValue) Test(org.junit.jupiter.api.Test) DMNModelMetadata(org.kie.kogito.trusty.storage.api.model.decision.DMNModelMetadata) List(java.util.List) ExplainabilityRequestProducer(org.kie.kogito.trusty.service.common.messaging.outgoing.ExplainabilityRequestProducer) OffsetDateTime(java.time.OffsetDateTime) Stream(java.util.stream.Stream) CollectionValue(org.kie.kogito.tracing.typedvalue.CollectionValue) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) CounterfactualExplainabilityResult(org.kie.kogito.explainability.api.CounterfactualExplainabilityResult) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) StorageImplMock(org.kie.kogito.trusty.service.common.mocks.StorageImplMock) DecisionOutcome(org.kie.kogito.trusty.storage.api.model.decision.DecisionOutcome) Mockito.mock(org.mockito.Mockito.mock) IntStream(java.util.stream.IntStream) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) Decision(org.kie.kogito.trusty.storage.api.model.decision.Decision) DecisionInput(org.kie.kogito.trusty.storage.api.model.decision.DecisionInput) IntNode(com.fasterxml.jackson.databind.node.IntNode) Query(org.kie.kogito.persistence.api.query.Query) StructureValue(org.kie.kogito.tracing.typedvalue.StructureValue) ArrayList(java.util.ArrayList) MatchedExecutionHeaders(org.kie.kogito.trusty.service.common.models.MatchedExecutionHeaders) CounterfactualSearchDomainStructureValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainStructureValue) ArgumentCaptor(org.mockito.ArgumentCaptor) ExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandler) ExplainerServiceHandlerRegistry(org.kie.kogito.trusty.service.common.handlers.ExplainerServiceHandlerRegistry) Storage(org.kie.kogito.persistence.api.Storage) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) LIMEExplainerServiceHandler(org.kie.kogito.trusty.service.common.handlers.LIMEExplainerServiceHandler) TrustyStorageService(org.kie.kogito.trusty.storage.common.TrustyStorageService) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) Mockito.never(org.mockito.Mockito.never) CounterfactualDomain(org.kie.kogito.explainability.api.CounterfactualDomain) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) Assertions(org.junit.jupiter.api.Assertions) Collections(java.util.Collections) DMNModelWithMetadata(org.kie.kogito.trusty.storage.api.model.decision.DMNModelWithMetadata) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CounterfactualDomainRange(org.kie.kogito.explainability.api.CounterfactualDomainRange) DecisionOutcome(org.kie.kogito.trusty.storage.api.model.decision.DecisionOutcome) UnitValue(org.kie.kogito.tracing.typedvalue.UnitValue) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Decision(org.kie.kogito.trusty.storage.api.model.decision.Decision) IntNode(com.fasterxml.jackson.databind.node.IntNode) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) BaseExplainabilityRequest(org.kie.kogito.explainability.api.BaseExplainabilityRequest) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) CounterfactualSearchDomainValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainValue) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) Test(org.junit.jupiter.api.Test)

Aggregations

NamedTypedValue (org.kie.kogito.explainability.api.NamedTypedValue)33 Test (org.junit.jupiter.api.Test)27 UnitValue (org.kie.kogito.tracing.typedvalue.UnitValue)22 IntNode (com.fasterxml.jackson.databind.node.IntNode)19 CounterfactualExplainabilityRequest (org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest)19 CounterfactualSearchDomain (org.kie.kogito.explainability.api.CounterfactualSearchDomain)19 CounterfactualSearchDomainUnitValue (org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue)16 CounterfactualDomainRange (org.kie.kogito.explainability.api.CounterfactualDomainRange)12 CounterfactualExplainabilityResult (org.kie.kogito.explainability.api.CounterfactualExplainabilityResult)11 StructureValue (org.kie.kogito.tracing.typedvalue.StructureValue)11 List (java.util.List)9 CounterfactualSearchDomainStructureValue (org.kie.kogito.explainability.api.CounterfactualSearchDomainStructureValue)9 Prediction (org.kie.kogito.explainability.model.Prediction)9 CollectionValue (org.kie.kogito.tracing.typedvalue.CollectionValue)9 Map (java.util.Map)8 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)8 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)8 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)8 ModelIdentifier (org.kie.kogito.explainability.api.ModelIdentifier)8 CounterfactualPrediction (org.kie.kogito.explainability.model.CounterfactualPrediction)8