Search in sources :

Example 1 with LocalExplainerServiceHandlerRegistry

use of org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry in project kogito-apps by kiegroup.

the class ExplanationServiceImplTest method init.

@BeforeEach
@SuppressWarnings("unchecked")
void init() {
    instance = mock(Instance.class);
    limeExplainerMock = mock(LimeExplainer.class);
    cfExplainerMock = mock(CounterfactualExplainer.class);
    PredictionProviderFactory predictionProviderFactory = mock(PredictionProviderFactory.class);
    explainerServiceHandlerRegistryMock = new LocalExplainerServiceHandlerRegistry(instance);
    limeExplainerServiceHandlerMock = spy(new LimeExplainerServiceHandler(limeExplainerMock, predictionProviderFactory));
    cfExplainerServiceHandlerMock = spy(new CounterfactualExplainerServiceHandler(cfExplainerMock, predictionProviderFactory, MAX_RUNNING_TIME_SECONDS));
    predictionProviderMock = mock(PredictionProvider.class);
    callbackMock = mock(Consumer.class);
    explanationService = new ExplanationServiceImpl(explainerServiceHandlerRegistryMock);
    when(predictionProviderFactory.createPredictionProvider(any(), any(), any())).thenReturn(predictionProviderMock);
}
Also used : LocalExplainerServiceHandlerRegistry(org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry) LimeExplainerServiceHandler(org.kie.kogito.explainability.handlers.LimeExplainerServiceHandler) Consumer(java.util.function.Consumer) Instance(javax.enterprise.inject.Instance) LimeExplainer(org.kie.kogito.explainability.local.lime.LimeExplainer) CounterfactualExplainer(org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer) PredictionProvider(org.kie.kogito.explainability.model.PredictionProvider) CounterfactualExplainerServiceHandler(org.kie.kogito.explainability.handlers.CounterfactualExplainerServiceHandler) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with LocalExplainerServiceHandlerRegistry

use of org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry in project kogito-apps by kiegroup.

the class ExplainabilityMessagingHandlerTest method setup.

@BeforeEach
void setup() {
    explanationService = mock(ExplanationService.class);
    LocalExplainerServiceHandlerRegistry explainerServiceHandlerRegistry = mock(LocalExplainerServiceHandlerRegistry.class);
    handler = new ExplainabilityMessagingHandler(explanationService, explainerServiceHandlerRegistry);
    handler.objectMapper = MAPPER;
}
Also used : LocalExplainerServiceHandlerRegistry(org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry) ExplanationService(org.kie.kogito.explainability.ExplanationService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BeforeEach (org.junit.jupiter.api.BeforeEach)2 LocalExplainerServiceHandlerRegistry (org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry)2 Consumer (java.util.function.Consumer)1 Instance (javax.enterprise.inject.Instance)1 ExplanationService (org.kie.kogito.explainability.ExplanationService)1 CounterfactualExplainerServiceHandler (org.kie.kogito.explainability.handlers.CounterfactualExplainerServiceHandler)1 LimeExplainerServiceHandler (org.kie.kogito.explainability.handlers.LimeExplainerServiceHandler)1 CounterfactualExplainer (org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer)1 LimeExplainer (org.kie.kogito.explainability.local.lime.LimeExplainer)1 PredictionProvider (org.kie.kogito.explainability.model.PredictionProvider)1