use of org.kie.kogito.explainability.local.counterfactual.entities.CategoricalEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testCategoricalFactorySet.
@Test
void testCategoricalFactorySet() {
final String value = "foo";
final FeatureDomain domain = CategoricalFeatureDomain.create(Set.of("foo", "bar"));
final Feature feature = FeatureFactory.newCategoricalFeature("categorical-feature", value, domain);
final CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof CategoricalEntity);
assertEquals(domain.getCategories(), ((CategoricalEntity) counterfactualEntity).getValueRange());
assertEquals(value, counterfactualEntity.asFeature().getValue().toString());
}
use of org.kie.kogito.explainability.local.counterfactual.entities.CategoricalEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testCategoricalFactoryList.
@Test
void testCategoricalFactoryList() {
final String value = "foo";
final FeatureDomain domain = CategoricalFeatureDomain.create(List.of("foo", "bar"));
final Feature feature = FeatureFactory.newCategoricalFeature("categorical-feature", value, domain);
final CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof CategoricalEntity);
assertEquals(domain.getCategories(), ((CategoricalEntity) counterfactualEntity).getValueRange());
assertEquals(value, counterfactualEntity.asFeature().getValue().toString());
}
use of org.kie.kogito.explainability.local.counterfactual.entities.CategoricalEntity in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testCategoricalFactoryObject.
@Test
void testCategoricalFactoryObject() {
final String value = "foo";
final FeatureDomain domain = CategoricalFeatureDomain.create("foo", "bar");
final Feature feature = FeatureFactory.newCategoricalFeature("categorical-feature", value, domain);
final CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof CategoricalEntity);
assertEquals(domain.getCategories(), ((CategoricalEntity) counterfactualEntity).getValueRange());
assertEquals(value, counterfactualEntity.asFeature().getValue().toString());
}
Aggregations