@Test public void getKiePMMLReasonCodeAndValueUseReasonCodesFalse() { assertNull(getKiePMMLScorecardModelCharacteristicASTFactory().getKiePMMLReasonCodeAndValue(new Attribute(), "", 0)); }
protected KiePMMLReasonCodeAndValue getKiePMMLReasonCodeAndValue(final Attribute attribute, final String characteristicReasonCode, final Number characteristicBaselineScore) { if (!useReasonCodes) { return null; } if (characteristicBaselineScore == null && baselineScore == null) { throw new KiePMMLException("Missing default and characteristic defined baselineScore needed for useReasonCodes == true"); } if (reasonCodeAlgorithm == null) { throw new KiePMMLException("Missing reasonCodeAlgorithm needed for useReasonCodes == true"); } String reasonCode = attribute.getReasonCode() != null && !(attribute.getReasonCode().isEmpty()) ? attribute.getReasonCode() : characteristicReasonCode; if (reasonCode == null || reasonCode.isEmpty()) { throw new KiePMMLException("Missing reasonCode needed for useReasonCodes == true"); } double baseLineScoreToUse = characteristicBaselineScore != null ? characteristicBaselineScore.doubleValue() : baselineScore.doubleValue(); double partialScoreToUse = attribute.getPartialScore() != null ? attribute.getPartialScore().doubleValue() : 0.0; if (REASONCODE_ALGORITHM.POINTS_BELOW.equals(reasonCodeAlgorithm)) { baseLineScoreToUse = baseLineScoreToUse - partialScoreToUse; } else { baseLineScoreToUse = partialScoreToUse - baseLineScoreToUse; } return new KiePMMLReasonCodeAndValue(reasonCode, baseLineScoreToUse); }
KiePMMLScorecardModelCharacteristicASTFactory { protected KiePMMLReasonCodeAndValue getKiePMMLReasonCodeAndValue(final Attribute attribute, final String characteristicReasonCode, final Number characteristicBaselineScore) { if (!useReasonCodes) { return null; } if (characteristicBaselineScore == null && baselineScore == null) { throw new KiePMMLException("Missing default and characteristic defined baselineScore needed for useReasonCodes == true"); } if (reasonCodeAlgorithm == null) { throw new KiePMMLException("Missing reasonCodeAlgorithm needed for useReasonCodes == true"); } String reasonCode = attribute.getReasonCode() != null && !(attribute.getReasonCode().isEmpty()) ? attribute.getReasonCode() : characteristicReasonCode; if (reasonCode == null || reasonCode.isEmpty()) { throw new KiePMMLException("Missing reasonCode needed for useReasonCodes == true"); } double baseLineScoreToUse = characteristicBaselineScore != null ? characteristicBaselineScore.doubleValue() : baselineScore.doubleValue(); double partialScoreToUse = attribute.getPartialScore() != null ? attribute.getPartialScore().doubleValue() : 0.0; if (REASONCODE_ALGORITHM.POINTS_BELOW.equals(reasonCodeAlgorithm)) { baseLineScoreToUse = baseLineScoreToUse - partialScoreToUse; } else { baseLineScoreToUse = partialScoreToUse - baseLineScoreToUse; } return new KiePMMLReasonCodeAndValue(reasonCode, baseLineScoreToUse); } }
KiePMMLScorecardModelCharacteristicASTFactory { protected KiePMMLReasonCodeAndValue getKiePMMLReasonCodeAndValue(final Attribute attribute, final String characteristicReasonCode, final Number characteristicBaselineScore) { if (!useReasonCodes) { return null; } if (characteristicBaselineScore == null && baselineScore == null) { throw new KiePMMLException("Missing default and characteristic defined baselineScore needed for useReasonCodes == true"); } if (reasonCodeAlgorithm == null) { throw new KiePMMLException("Missing reasonCodeAlgorithm needed for useReasonCodes == true"); } String reasonCode = attribute.getReasonCode() != null && !(attribute.getReasonCode().isEmpty()) ? attribute.getReasonCode() : characteristicReasonCode; if (reasonCode == null || reasonCode.isEmpty()) { throw new KiePMMLException("Missing reasonCode needed for useReasonCodes == true"); } double baseLineScoreToUse = characteristicBaselineScore != null ? characteristicBaselineScore.doubleValue() : baselineScore.doubleValue(); double partialScoreToUse = attribute.getPartialScore() != null ? attribute.getPartialScore().doubleValue() : 0.0; if (REASONCODE_ALGORITHM.POINTS_BELOW.equals(reasonCodeAlgorithm)) { baseLineScoreToUse = baseLineScoreToUse - partialScoreToUse; } else { baseLineScoreToUse = partialScoreToUse - baseLineScoreToUse; } return new KiePMMLReasonCodeAndValue(reasonCode, baseLineScoreToUse); } private  KiePMMLScorecardModelCharacteristicASTFactory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); }
KiePMMLScorecardModelCharacteristicASTFactory { protected KiePMMLReasonCodeAndValue getKiePMMLReasonCodeAndValue(final Attribute attribute, final String characteristicReasonCode, final Number characteristicBaselineScore) { if (!useReasonCodes) { return null; } if (characteristicBaselineScore == null && baselineScore == null) { throw new KiePMMLException("Missing default and characteristic defined baselineScore needed for useReasonCodes == true"); } if (reasonCodeAlgorithm == null) { throw new KiePMMLException("Missing reasonCodeAlgorithm needed for useReasonCodes == true"); } String reasonCode = attribute.getReasonCode() != null && !(attribute.getReasonCode().isEmpty()) ? attribute.getReasonCode() : characteristicReasonCode; if (reasonCode == null || reasonCode.isEmpty()) { throw new KiePMMLException("Missing reasonCode needed for useReasonCodes == true"); } double baseLineScoreToUse = characteristicBaselineScore != null ? characteristicBaselineScore.doubleValue() : baselineScore.doubleValue(); double partialScoreToUse = attribute.getPartialScore() != null ? attribute.getPartialScore().doubleValue() : 0.0; if (REASONCODE_ALGORITHM.POINTS_BELOW.equals(reasonCodeAlgorithm)) { baseLineScoreToUse = baseLineScoreToUse - partialScoreToUse; } else { baseLineScoreToUse = partialScoreToUse - baseLineScoreToUse; } return new KiePMMLReasonCodeAndValue(reasonCode, baseLineScoreToUse); } private  KiePMMLScorecardModelCharacteristicASTFactory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); static KiePMMLScorecardModelCharacteristicASTFactory factory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); KiePMMLScorecardModelCharacteristicASTFactory withReasonCodes(Number baselineScore, REASONCODE_ALGORITHM reasonCodeAlgorithm); List<KiePMMLDroolsRule> declareRulesFromCharacteristics(final Characteristics characteristics, final String parentPath, Number initialScore); }
KiePMMLScorecardModelCharacteristicASTFactory { protected KiePMMLReasonCodeAndValue getKiePMMLReasonCodeAndValue(final Attribute attribute, final String characteristicReasonCode, final Number characteristicBaselineScore) { if (!useReasonCodes) { return null; } if (characteristicBaselineScore == null && baselineScore == null) { throw new KiePMMLException("Missing default and characteristic defined baselineScore needed for useReasonCodes == true"); } if (reasonCodeAlgorithm == null) { throw new KiePMMLException("Missing reasonCodeAlgorithm needed for useReasonCodes == true"); } String reasonCode = attribute.getReasonCode() != null && !(attribute.getReasonCode().isEmpty()) ? attribute.getReasonCode() : characteristicReasonCode; if (reasonCode == null || reasonCode.isEmpty()) { throw new KiePMMLException("Missing reasonCode needed for useReasonCodes == true"); } double baseLineScoreToUse = characteristicBaselineScore != null ? characteristicBaselineScore.doubleValue() : baselineScore.doubleValue(); double partialScoreToUse = attribute.getPartialScore() != null ? attribute.getPartialScore().doubleValue() : 0.0; if (REASONCODE_ALGORITHM.POINTS_BELOW.equals(reasonCodeAlgorithm)) { baseLineScoreToUse = baseLineScoreToUse - partialScoreToUse; } else { baseLineScoreToUse = partialScoreToUse - baseLineScoreToUse; } return new KiePMMLReasonCodeAndValue(reasonCode, baseLineScoreToUse); } private  KiePMMLScorecardModelCharacteristicASTFactory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); static KiePMMLScorecardModelCharacteristicASTFactory factory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); KiePMMLScorecardModelCharacteristicASTFactory withReasonCodes(Number baselineScore, REASONCODE_ALGORITHM reasonCodeAlgorithm); List<KiePMMLDroolsRule> declareRulesFromCharacteristics(final Characteristics characteristics, final String parentPath, Number initialScore);  }