Search in sources :

Example 1 with CounterfactualExplainerServiceHandler

use of org.kie.kogito.explainability.handlers.CounterfactualExplainerServiceHandler 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)

Aggregations

Consumer (java.util.function.Consumer)1 Instance (javax.enterprise.inject.Instance)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 CounterfactualExplainerServiceHandler (org.kie.kogito.explainability.handlers.CounterfactualExplainerServiceHandler)1 LimeExplainerServiceHandler (org.kie.kogito.explainability.handlers.LimeExplainerServiceHandler)1 LocalExplainerServiceHandlerRegistry (org.kie.kogito.explainability.handlers.LocalExplainerServiceHandlerRegistry)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