Search in sources :

Example 1 with TimeEntity

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

the class CounterfactualEntityFactoryTest method testTimeFactory.

@Test
void testTimeFactory() {
    final LocalTime value = LocalTime.now();
    Feature feature = FeatureFactory.newTimeFeature("time-feature", value);
    CounterfactualEntity counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof FixedTimeEntity);
    assertEquals(Type.TIME, counterfactualEntity.asFeature().getType());
    FeatureDomain domain = TimeFeatureDomain.create(value.minusHours(10), value.plusHours(10));
    feature = FeatureFactory.newTimeFeature("time-feature", value, domain);
    counterfactualEntity = CounterfactualEntityFactory.from(feature);
    assertTrue(counterfactualEntity instanceof TimeEntity);
    assertEquals(Type.TIME, counterfactualEntity.asFeature().getType());
    assertEquals(value, ((TimeEntity) counterfactualEntity).getProposedValue());
}
Also used : CounterfactualEntity(org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity) FixedTimeEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedTimeEntity) TimeEntity(org.kie.kogito.explainability.local.counterfactual.entities.TimeEntity) LocalTime(java.time.LocalTime) FixedTimeEntity(org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedTimeEntity) 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) Feature(org.kie.kogito.explainability.model.Feature) Test(org.junit.jupiter.api.Test)

Aggregations

LocalTime (java.time.LocalTime)1 Test (org.junit.jupiter.api.Test)1 CounterfactualEntity (org.kie.kogito.explainability.local.counterfactual.entities.CounterfactualEntity)1 TimeEntity (org.kie.kogito.explainability.local.counterfactual.entities.TimeEntity)1 FixedTimeEntity (org.kie.kogito.explainability.local.counterfactual.entities.fixed.FixedTimeEntity)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