Search in sources :

Example 1 with KiePMMLTruePredicate

use of org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate in project drools by kiegroup.

the class KiePMMLCharacteristicsTest method getKiePMMLCharacteristicList.

private List<KiePMMLCharacteristic> getKiePMMLCharacteristicList() {
    List<KiePMMLCharacteristic> toReturn = new ArrayList<>();
    // <Characteristic name="CUSTOM_FIELD_0" baselineScore="123" reasonCode="REASONCODE_0">
    // <Attribute partialScore="100" reasonCode="REASON_CODE_10" >
    // <False/>
    // </Attribute>
    // <Attribute partialScore="5" reasonCode="REASON_CODE_20" >
    // <True/>
    // </Attribute>
    // </Characteristic>
    KiePMMLFalsePredicate falsePredicate = KiePMMLFalsePredicate.builder(Collections.emptyList()).build();
    KiePMMLTruePredicate truePredicate = KiePMMLTruePredicate.builder(Collections.emptyList()).build();
    KiePMMLAttribute attribute00 = KiePMMLAttribute.builder(ATTRIBUTE_1 + 0, Collections.emptyList(), falsePredicate).withPartialScore(value1).withReasonCode(REASON_CODE_1 + 0).build();
    KiePMMLAttribute attribute01 = KiePMMLAttribute.builder(ATTRIBUTE_2 + 0, Collections.emptyList(), truePredicate).withPartialScore(value2).withReasonCode(REASON_CODE_2 + 0).build();
    toReturn.add(KiePMMLCharacteristic.builder(CUSTOM_FIELD + 0, Collections.emptyList(), Arrays.asList(attribute00, attribute01)).withBaselineScore(baselineScore).withReasonCode(REASON_CODE + 0).build());
    // <Characteristic name="CUSTOM_FIELD_1" baselineScore="124" reasonCode="REASONCODE_1">
    // <Attribute partialScore="101" reasonCode="REASON_CODE_11">
    // <True/>
    // </Attribute>
    // <Attribute partialScore="6" reasonCode="REASON_CODE_21">
    // <False/>
    // </Attribute>
    // </Characteristic>
    KiePMMLAttribute attribute10 = KiePMMLAttribute.builder(ATTRIBUTE_1 + 1, Collections.emptyList(), truePredicate).withPartialScore(value1 + 1).withReasonCode(REASON_CODE_1 + 1).build();
    KiePMMLAttribute attribute11 = KiePMMLAttribute.builder(ATTRIBUTE_2 + 1, Collections.emptyList(), falsePredicate).withPartialScore(value2 + 1).withReasonCode(REASON_CODE_2 + 1).build();
    toReturn.add(KiePMMLCharacteristic.builder(CUSTOM_FIELD + 1, Collections.emptyList(), Arrays.asList(attribute10, attribute11)).withBaselineScore(baselineScore + 1).withReasonCode(REASON_CODE + 1).build());
    return toReturn;
}
Also used : KiePMMLFalsePredicate(org.kie.pmml.commons.model.predicates.KiePMMLFalsePredicate) KiePMMLTruePredicate(org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate) ArrayList(java.util.ArrayList)

Example 2 with KiePMMLTruePredicate

use of org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate in project drools by kiegroup.

the class KiePMMLScorecardModelTest method getKiePMMLCharacteristicList.

private List<KiePMMLCharacteristic> getKiePMMLCharacteristicList() {
    List<KiePMMLCharacteristic> toReturn = new ArrayList<>();
    // <Characteristic name="CUSTOM_FIELD_0" baselineScore="123" reasonCode="REASONCODE_0">
    // <Attribute partialScore="100" reasonCode="REASON_CODE_10" >
    // <False/>
    // </Attribute>
    // <Attribute partialScore="5" reasonCode="REASON_CODE_20" >
    // <True/>
    // </Attribute>
    // </Characteristic>
    KiePMMLFalsePredicate falsePredicate = KiePMMLFalsePredicate.builder(Collections.emptyList()).build();
    KiePMMLTruePredicate truePredicate = KiePMMLTruePredicate.builder(Collections.emptyList()).build();
    KiePMMLAttribute attribute00 = KiePMMLAttribute.builder(ATTRIBUTE_1 + 0, Collections.emptyList(), falsePredicate).withPartialScore(value1).withReasonCode(REASON_CODE_1 + 0).build();
    KiePMMLAttribute attribute01 = KiePMMLAttribute.builder(ATTRIBUTE_2 + 0, Collections.emptyList(), truePredicate).withPartialScore(value2).withReasonCode(REASON_CODE_2 + 0).build();
    toReturn.add(KiePMMLCharacteristic.builder(CUSTOM_FIELD + 0, Collections.emptyList(), Arrays.asList(attribute00, attribute01)).withBaselineScore(baselineScore).withReasonCode(REASON_CODE + 0).build());
    // <Characteristic name="CUSTOM_FIELD_1" baselineScore="124" reasonCode="REASONCODE_1">
    // <Attribute partialScore="101" reasonCode="REASON_CODE_11">
    // <True/>
    // </Attribute>
    // <Attribute partialScore="6" reasonCode="REASON_CODE_21">
    // <False/>
    // </Attribute>
    // </Characteristic>
    KiePMMLAttribute attribute10 = KiePMMLAttribute.builder(ATTRIBUTE_1 + 1, Collections.emptyList(), truePredicate).withPartialScore(value1 + 1).withReasonCode(REASON_CODE_1 + 1).build();
    KiePMMLAttribute attribute11 = KiePMMLAttribute.builder(ATTRIBUTE_2 + 1, Collections.emptyList(), falsePredicate).withPartialScore(value2 + 1).withReasonCode(REASON_CODE_2 + 1).build();
    toReturn.add(KiePMMLCharacteristic.builder(CUSTOM_FIELD + 1, Collections.emptyList(), Arrays.asList(attribute10, attribute11)).withBaselineScore(baselineScore + 1).withReasonCode(REASON_CODE + 1).build());
    return toReturn;
}
Also used : KiePMMLFalsePredicate(org.kie.pmml.commons.model.predicates.KiePMMLFalsePredicate) KiePMMLTruePredicate(org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 KiePMMLFalsePredicate (org.kie.pmml.commons.model.predicates.KiePMMLFalsePredicate)2 KiePMMLTruePredicate (org.kie.pmml.commons.model.predicates.KiePMMLTruePredicate)2