use of org.kie.kogito.explainability.model.domain.FeatureDomain in project kogito-apps by kiegroup.
the class FeatureDomainTest method isEmpty.
@Test
void isEmpty() {
final FeatureDomain domain = EmptyFeatureDomain.create();
assertNull(domain.getCategories());
assertNull(domain.getLowerBound());
assertNull(domain.getUpperBound());
assertTrue(domain.isEmpty());
}
use of org.kie.kogito.explainability.model.domain.FeatureDomain 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.model.domain.FeatureDomain in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testIntegerFactory.
@Test
void testIntegerFactory() {
final int value = 5;
final FeatureDomain domain = NumericalFeatureDomain.create(0.0, 10.0);
final Feature feature = FeatureFactory.newNumericalFeature("int-feature", value, domain);
final CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertTrue(counterfactualEntity instanceof IntegerEntity);
assertEquals(value, counterfactualEntity.asFeature().getValue().asNumber());
}
use of org.kie.kogito.explainability.model.domain.FeatureDomain in project kogito-apps by kiegroup.
the class CounterfactualEntityFactoryTest method testLongFactory.
@Test
void testLongFactory() {
final long value = 5;
final FeatureDomain domain = NumericalFeatureDomain.create(0.0, 10.0);
final Feature feature = FeatureFactory.newNumericalFeature("long-feature", value, domain);
final CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
assertNotNull(counterfactualEntity);
assertTrue(counterfactualEntity instanceof LongEntity);
assertEquals(value, counterfactualEntity.asFeature().getValue().asNumber());
}
use of org.kie.kogito.explainability.model.domain.FeatureDomain 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