Search in sources :

Example 1 with ObjectEntity

use of org.kie.kogito.explainability.local.counterfactual.entities.ObjectEntity in project kogito-apps by kiegroup.

the class CounterfactualEntityFactoryTest method testObjectFactory.

@Test
void testObjectFactory() {
    final URI value = URI.create("./");
    Feature feature = FeatureFactory.newObjectFeature("f", value);
    CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof FixedObjectEntity);
    assertEquals(Type.UNDEFINED, counterfactualEntity.asFeature().getType());
    FeatureDomain domain = ObjectFeatureDomain.create("test", 45L);
    feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof ObjectEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
    domain = ObjectFeatureDomain.create(List.of("test", 45L));
    feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof ObjectEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
    domain = ObjectFeatureDomain.create(Set.of("test", 45L));
    feature = FeatureFactory.newObjectFeature("uri-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof ObjectEntity);
    assertEquals(value, counterfactualEntity.asFeature().getValue().getUnderlyingObject());
}
Also used : CounterfactualEntity(org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity) FixedObjectEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedObjectEntity) ObjectEntity(org.kie.kogito.explainability.local.counterfactual.entities.ObjectEntity) FixedObjectEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedObjectEntity) ObjectFeatureDomain(org.kie.kogito.explainability.model.domain.ObjectFeatureDomain) EmptyFeatureDomain(org.kie.kogito.explainability.model.domain.EmptyFeatureDomain) CategoricalFeatureDomain(org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain) CurrencyFeatureDomain(org.kie.kogito.explainability.model.domain.CurrencyFeatureDomain) URIFeatureDomain(org.kie.kogito.explainability.model.domain.URIFeatureDomain) DurationFeatureDomain(org.kie.kogito.explainability.model.domain.DurationFeatureDomain) TimeFeatureDomain(org.kie.kogito.explainability.model.domain.TimeFeatureDomain) NumericalFeatureDomain(org.kie.kogito.explainability.model.domain.NumericalFeatureDomain) BinaryFeatureDomain(org.kie.kogito.explainability.model.domain.BinaryFeatureDomain) FeatureDomain(org.kie.kogito.explainability.model.domain.FeatureDomain) URI(java.net.URI) Feature(org.kie.kogito.explainability.model.Feature) Test(org.junit.jupiter.api.Test)

Aggregations

URI (java.net.URI)1 Test (org.junit.jupiter.api.Test)1 CounterfactualEntity (org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity)1 ObjectEntity (org.kie.kogito.explainability.local.counterfactual.entities.ObjectEntity)1 FixedObjectEntity (org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedObjectEntity)1 Feature (org.kie.kogito.explainability.model.Feature)1 BinaryFeatureDomain (org.kie.kogito.explainability.model.domain.BinaryFeatureDomain)1 CategoricalFeatureDomain (org.kie.kogito.explainability.model.domain.CategoricalFeatureDomain)1 CurrencyFeatureDomain (org.kie.kogito.explainability.model.domain.CurrencyFeatureDomain)1 DurationFeatureDomain (org.kie.kogito.explainability.model.domain.DurationFeatureDomain)1 EmptyFeatureDomain (org.kie.kogito.explainability.model.domain.EmptyFeatureDomain)1 FeatureDomain (org.kie.kogito.explainability.model.domain.FeatureDomain)1 NumericalFeatureDomain (org.kie.kogito.explainability.model.domain.NumericalFeatureDomain)1 ObjectFeatureDomain (org.kie.kogito.explainability.model.domain.ObjectFeatureDomain)1 TimeFeatureDomain (org.kie.kogito.explainability.model.domain.TimeFeatureDomain)1 URIFeatureDomain (org.kie.kogito.explainability.model.domain.URIFeatureDomain)1