Interface LocalExplainerServiceHandler<T,R extends BaseExplainabilityRequest>
- Type Parameters:
T- the type of local explanation generatedR- the type of the local explanation request
- All Superinterfaces:
org.kie.kogito.explainability.local.LocalExplainer<T>
- All Known Implementing Classes:
CounterfactualExplainerServiceHandler,LimeExplainerServiceHandler
public interface LocalExplainerServiceHandler<T,R extends BaseExplainabilityRequest>
extends org.kie.kogito.explainability.local.LocalExplainer<T>
A local explainability handler that delegates explanation to a
LocalExplainer and handles assembly
of the BaseExplainabilityResult for both success and failure states of explanation calculation.-
Method Summary
Modifier and TypeMethodDescriptioncreateFailedResult(R request, Throwable throwable) Creates a result containing the "failed" information for an explanation calculation.createIntermediateResult(R request, T result) Creates a result containing the "intermediate" information for an explanation calculation.createSucceededResult(R request, T result) Creates a result containing the "success" information for an explanation calculation.explainAsyncWithResults(R request, Consumer<BaseExplainabilityResult> intermediateResultsConsumer) Requests calculation of an explanation decorated with both "success" and "failure" result handlers.org.kie.kogito.explainability.model.PredictiongetPrediction(R request) Gets a Prediction object from the request for the LocalExplainer.org.kie.kogito.explainability.model.PredictionProvidergetPredictionProvider(R request) Gets a PredictionProvider object from the request for the LocalExplainer.<U extends BaseExplainabilityRequest>
booleanChecks whether an implementation supports a type of explanation.Methods inherited from interface org.kie.kogito.explainability.local.LocalExplainer
explainAsync, explainAsync
-
Method Details
-
supports
Checks whether an implementation supports a type of explanation.- Parameters:
type- The Trusty Service request type.- Returns:
- true if the implementation supports the type of explanation.
-
getPrediction
Gets a Prediction object from the request for the LocalExplainer. It should contain all the necessary information for the LocalExplainer to calculate an explanation.- Parameters:
request- The explanation request.- Returns:
- A Prediction object containing all of the information necessary to calculate an explanation.
-
getPredictionProvider
Gets a PredictionProvider object from the request for the LocalExplainer.- Parameters:
request- The explanation request.- Returns:
- A PredictionProvider object.
-
explainAsyncWithResults
default CompletableFuture<BaseExplainabilityResult> explainAsyncWithResults(R request, Consumer<BaseExplainabilityResult> intermediateResultsConsumer) Requests calculation of an explanation decorated with both "success" and "failure" result handlers. See: -LocalExplainer.explainAsync(org.kie.kogito.explainability.model.Prediction, org.kie.kogito.explainability.model.PredictionProvider)-createSucceededResult(BaseExplainabilityRequest, Object)-createFailedResult(BaseExplainabilityRequest, Throwable)- Parameters:
request- The explanation request.intermediateResultsConsumer- A consumer for intermediate results provided by the explainer.- Returns:
-
createSucceededResult
Creates a result containing the "success" information for an explanation calculation.- Parameters:
request- The original request.result- The result from the LocalExplainer calculation.- Returns:
-
createFailedResult
Creates a result containing the "failed" information for an explanation calculation.- Parameters:
request- The original request.throwable- The exception thrown during calculation.- Returns:
-
createIntermediateResult
Creates a result containing the "intermediate" information for an explanation calculation.- Parameters:
request- The original request.result- The intermediate result from the LocalExplainer calculation.- Returns:
-