Search in sources :

Example 1 with PredictionProviderFactory

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

the class LimeExplainerServiceHandlerTest method setup.

@BeforeEach
public void setup() {
    PredictionProviderFactory predictionProviderFactory = mock(PredictionProviderFactory.class);
    this.explainer = mock(LimeExplainer.class);
    this.handler = new LimeExplainerServiceHandler(explainer, predictionProviderFactory);
}
Also used : LimeExplainer(org.kie.kogito.explainability.local.lime.LimeExplainer) PredictionProviderFactory(org.kie.kogito.explainability.PredictionProviderFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with PredictionProviderFactory

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

the class CounterfactualExplainerServiceHandlerTest method setup.

@BeforeEach
public void setup() {
    PredictionProviderFactory predictionProviderFactory = mock(PredictionProviderFactory.class);
    this.explainer = mock(CounterfactualExplainer.class);
    this.handler = new CounterfactualExplainerServiceHandler(explainer, predictionProviderFactory, MAX_RUNNING_TIME_MILLISECONDS);
}
Also used : CounterfactualExplainer(org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer) PredictionProviderFactory(org.kie.kogito.explainability.PredictionProviderFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with PredictionProviderFactory

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

the class LocalExplainerServiceHandlerRegistryTest method setup.

@BeforeEach
@SuppressWarnings("unchecked")
public void setup() {
    LimeExplainer limeExplainer = mock(LimeExplainer.class);
    CounterfactualExplainer counterfactualExplainer = mock(CounterfactualExplainer.class);
    PredictionProviderFactory predictionProviderFactory = mock(PredictionProviderFactory.class);
    limeExplainerServiceHandler = spy(new LimeExplainerServiceHandler(limeExplainer, predictionProviderFactory));
    counterfactualExplainerServiceHandler = spy(new CounterfactualExplainerServiceHandler(counterfactualExplainer, predictionProviderFactory, MAX_RUNNING_TIME_SECONDS));
    predictionProvider = mock(PredictionProvider.class);
    callback = mock(Consumer.class);
    when(predictionProviderFactory.createPredictionProvider(any(), any(), any())).thenReturn(predictionProvider);
    Instance<LocalExplainerServiceHandler<?, ?>> explanationHandlers = mock(Instance.class);
    when(explanationHandlers.stream()).thenReturn(Stream.of(limeExplainerServiceHandler, counterfactualExplainerServiceHandler));
    registry = new LocalExplainerServiceHandlerRegistry(explanationHandlers);
}
Also used : Consumer(java.util.function.Consumer) LimeExplainer(org.kie.kogito.explainability.local.lime.LimeExplainer) CounterfactualExplainer(org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer) PredictionProvider(org.kie.kogito.explainability.model.PredictionProvider) PredictionProviderFactory(org.kie.kogito.explainability.PredictionProviderFactory) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

BeforeEach (org.junit.jupiter.api.BeforeEach)3 PredictionProviderFactory (org.kie.kogito.explainability.PredictionProviderFactory)3 CounterfactualExplainer (org.kie.kogito.explainability.local.counterfactual.CounterfactualExplainer)2 LimeExplainer (org.kie.kogito.explainability.local.lime.LimeExplainer)2 Consumer (java.util.function.Consumer)1 PredictionProvider (org.kie.kogito.explainability.model.PredictionProvider)1