Class LimeExplainerServiceHandler
java.lang.Object
org.kie.kogito.explainability.handlers.LimeExplainerServiceHandler
- All Implemented Interfaces:
LocalExplainerServiceHandler<Map<String,,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> org.kie.kogito.explainability.local.LocalExplainer<Map<String,org.kie.kogito.explainability.model.Saliency>>
@ApplicationScoped
public class LimeExplainerServiceHandler
extends Object
implements LocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>,LIMEExplainabilityRequest>
-
Constructor Summary
ConstructorsConstructorDescriptionLimeExplainerServiceHandler(org.kie.kogito.explainability.local.lime.LimeExplainer explainer, PredictionProviderFactory predictionProviderFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateFailedResult(LIMEExplainabilityRequest request, Throwable throwable) Creates a result containing the "failed" information for an explanation calculation.createIntermediateResult(LIMEExplainabilityRequest request, Map<String, org.kie.kogito.explainability.model.Saliency> result) Creates a result containing the "intermediate" information for an explanation calculation.createSucceededResult(LIMEExplainabilityRequest request, Map<String, org.kie.kogito.explainability.model.Saliency> result) Creates a result containing the "success" information for an explanation calculation.CompletableFuture<Map<String,org.kie.kogito.explainability.model.Saliency>> explainAsync(org.kie.kogito.explainability.model.Prediction prediction, org.kie.kogito.explainability.model.PredictionProvider predictionProvider, Consumer<Map<String, org.kie.kogito.explainability.model.Saliency>> intermediateResultsConsumer) org.kie.kogito.explainability.model.PredictiongetPrediction(LIMEExplainabilityRequest request) Gets a Prediction object from the request for the LocalExplainer.org.kie.kogito.explainability.model.PredictionProviderGets a PredictionProvider object from the request for the LocalExplainer.<T extends BaseExplainabilityRequest>
booleanChecks whether an implementation supports a type of explanation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kie.kogito.explainability.local.LocalExplainer
explainAsyncMethods inherited from interface org.kie.kogito.explainability.handlers.LocalExplainerServiceHandler
explainAsyncWithResults
-
Constructor Details
-
LimeExplainerServiceHandler
@Inject public LimeExplainerServiceHandler(org.kie.kogito.explainability.local.lime.LimeExplainer explainer, PredictionProviderFactory predictionProviderFactory)
-
-
Method Details
-
supports
Description copied from interface:LocalExplainerServiceHandlerChecks whether an implementation supports a type of explanation.- Specified by:
supportsin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
type- The Trusty Service request type.- Returns:
- true if the implementation supports the type of explanation.
-
getPredictionProvider
public org.kie.kogito.explainability.model.PredictionProvider getPredictionProvider(LIMEExplainabilityRequest request) Description copied from interface:LocalExplainerServiceHandlerGets a PredictionProvider object from the request for the LocalExplainer.- Specified by:
getPredictionProviderin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
request- The explanation request.- Returns:
- A PredictionProvider object.
-
getPrediction
public org.kie.kogito.explainability.model.Prediction getPrediction(LIMEExplainabilityRequest request) Description copied from interface:LocalExplainerServiceHandlerGets a Prediction object from the request for the LocalExplainer. It should contain all the necessary information for the LocalExplainer to calculate an explanation.- Specified by:
getPredictionin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
request- The explanation request.- Returns:
- A Prediction object containing all of the information necessary to calculate an explanation.
-
createSucceededResult
public BaseExplainabilityResult createSucceededResult(LIMEExplainabilityRequest request, Map<String, org.kie.kogito.explainability.model.Saliency> result) Description copied from interface:LocalExplainerServiceHandlerCreates a result containing the "success" information for an explanation calculation.- Specified by:
createSucceededResultin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
request- The original request.result- The result from the LocalExplainer calculation.- Returns:
-
createIntermediateResult
public BaseExplainabilityResult createIntermediateResult(LIMEExplainabilityRequest request, Map<String, org.kie.kogito.explainability.model.Saliency> result) Description copied from interface:LocalExplainerServiceHandlerCreates a result containing the "intermediate" information for an explanation calculation.- Specified by:
createIntermediateResultin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
request- The original request.result- The intermediate result from the LocalExplainer calculation.- Returns:
-
createFailedResult
public BaseExplainabilityResult createFailedResult(LIMEExplainabilityRequest request, Throwable throwable) Description copied from interface:LocalExplainerServiceHandlerCreates a result containing the "failed" information for an explanation calculation.- Specified by:
createFailedResultin interfaceLocalExplainerServiceHandler<Map<String,org.kie.kogito.explainability.model.Saliency>, LIMEExplainabilityRequest> - Parameters:
request- The original request.throwable- The exception thrown during calculation.- Returns:
-
explainAsync
public CompletableFuture<Map<String,org.kie.kogito.explainability.model.Saliency>> explainAsync(org.kie.kogito.explainability.model.Prediction prediction, org.kie.kogito.explainability.model.PredictionProvider predictionProvider, Consumer<Map<String, org.kie.kogito.explainability.model.Saliency>> intermediateResultsConsumer)
-