Search in sources :

Example 1 with EmptyFeatureDomain

use of org.kie.kogito.explainability.model.domain.EmptyFeatureDomain in project kogito-apps by kiegroup.

the class ConversionUtilsTest method testToFeatureDomain_UnitFixedNumber.

@Test
void testToFeatureDomain_UnitFixedNumber() {
    FeatureDomain featureDomain = ConversionUtils.toFeatureDomain(new CounterfactualSearchDomainUnitValue("integer", "integer", true, null));
    assertTrue(featureDomain instanceof EmptyFeatureDomain);
}
Also used : EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) CategoricalFeatureDomain(org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain) NumericalFeatureDomain(org.kie.kogito.explainability.model.domain.NumericalFeatureDomain) FeatureDomain(org.kie.kogito.explainability.model.domain.FeatureDomain) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) Test(org.junit.jupiter.api.Test)

Example 2 with EmptyFeatureDomain

use of org.kie.kogito.explainability.model.domain.EmptyFeatureDomain in project kogito-apps by kiegroup.

the class CounterfactualExplainerServiceHandlerTest method testGetPredictionWithFlatSearchDomainsFixed.

@Test
public void testGetPredictionWithFlatSearchDomainsFixed() {
    CounterfactualExplainabilityRequest request = new CounterfactualExplainabilityRequest(EXECUTION_ID, SERVICE_URL, MODEL_IDENTIFIER, COUNTERFACTUAL_ID, List.of(new NamedTypedValue("output1", new UnitValue("number", new IntNode(25)))), Collections.emptyList(), List.of(new CounterfactualSearchDomain("output1", new CounterfactualSearchDomainUnitValue("number", "number", true, new CounterfactualDomainRange(new IntNode(10), new IntNode(20))))), MAX_RUNNING_TIME_SECONDS);
    Prediction prediction = handler.getPrediction(request);
    assertTrue(prediction instanceof CounterfactualPrediction);
    CounterfactualPrediction counterfactualPrediction = (CounterfactualPrediction) prediction;
    assertEquals(1, counterfactualPrediction.getInput().getFeatures().size());
    Feature feature1 = counterfactualPrediction.getInput().getFeatures().get(0);
    assertTrue(feature1.getDomain() instanceof EmptyFeatureDomain);
    assertEquals(counterfactualPrediction.getMaxRunningTimeSeconds(), request.getMaxRunningTimeSeconds());
}
Also used : CounterfactualExplainabilityRequest(org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest) NamedTypedValue(org.kie.kogito.explainability.api.NamedTypedValue) IntNode(com.fasterxml.jackson.databind.node.IntNode) CounterfactualDomainRange(org.kie.kogito.explainability.api.CounterfactualDomainRange) Prediction(org.kie.kogito.explainability.model.Prediction) CounterfactualPrediction(org.kie.kogito.explainability.model.CounterfactualPrediction) EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) UnitValue(org.kie.kogito.tracing.typedvalue.UnitValue) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) Feature(org.kie.kogito.explainability.model.Feature) CounterfactualSearchDomain(org.kie.kogito.explainability.api.CounterfactualSearchDomain) CounterfactualPrediction(org.kie.kogito.explainability.model.CounterfactualPrediction) Test(org.junit.jupiter.api.Test)

Example 3 with EmptyFeatureDomain

use of org.kie.kogito.explainability.model.domain.EmptyFeatureDomain in project kogito-apps by kiegroup.

the class ConversionUtilsTest method testToFeatureDomain_UnitFixedString.

@Test
void testToFeatureDomain_UnitFixedString() {
    FeatureDomain featureDomain = ConversionUtils.toFeatureDomain(new CounterfactualSearchDomainUnitValue("string", "string", true, null));
    assertTrue(featureDomain instanceof EmptyFeatureDomain);
}
Also used : EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) CategoricalFeatureDomain(org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain) NumericalFeatureDomain(org.kie.kogito.explainability.model.domain.NumericalFeatureDomain) FeatureDomain(org.kie.kogito.explainability.model.domain.FeatureDomain) CounterfactualSearchDomainUnitValue(org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)3 CounterfactualSearchDomainUnitValue (org.kie.kogito.explainability.api.CounterfactualSearchDomainUnitValue)3 EmptyFeatureDomain (org.kie.kogito.explainability.model.domain.EmptyFeatureDomain)3 CategoricalFeatureDomain (org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain)2 FeatureDomain (org.kie.kogito.explainability.model.domain.FeatureDomain)2 NumericalFeatureDomain (org.kie.kogito.explainability.model.domain.NumericalFeatureDomain)2 IntNode (com.fasterxml.jackson.databind.node.IntNode)1 CounterfactualDomainRange (org.kie.kogito.explainability.api.CounterfactualDomainRange)1 CounterfactualExplainabilityRequest (org.kie.kogito.explainability.api.CounterfactualExplainabilityRequest)1 CounterfactualSearchDomain (org.kie.kogito.explainability.api.CounterfactualSearchDomain)1 NamedTypedValue (org.kie.kogito.explainability.api.NamedTypedValue)1 CounterfactualPrediction (org.kie.kogito.explainability.model.CounterfactualPrediction)1 Feature (org.kie.kogito.explainability.model.Feature)1 Prediction (org.kie.kogito.explainability.model.Prediction)1 UnitValue (org.kie.kogito.tracing.typedvalue.UnitValue)1