Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PMML : Fix scorecards

  • Loading branch information...
commit 2eabf906074f74368c5a3aacb2cc7d3e336286e9 1 parent 97eb1a1
@sotty sotty authored
View
7 drools-pmml/src/main/resources/org/drools/pmml/pmml_4_1/templates/models/scorecard/scorecardDeclare.drlt
@@ -28,6 +28,7 @@
as in decision trees. The containment is then used to update data and aggregate scores independently, preserving truth maintenance }
declare ScoreCard
+@propertyReactive
modelName : String @key
score : double
holder : ScoreCardData
@@ -38,12 +39,13 @@ end
declare ScoreRank
- rank : java.util.Map
+ scoreCard : ScoreCard
+ rank : java.util.Map
end
declare ScoreCardData
@propertyReactive
- modelName : String @key
+ modelName : String @key
end
declare Score
@@ -70,6 +72,7 @@ declare ScoreRow extends Score
end
declare CodeScore
+ scoreCard : ScoreCard @key
code : String @key
score : double
end
View
2  ...pmml/src/main/resources/org/drools/pmml/pmml_4_1/templates/models/scorecard/scorecardOutputRankCode.drlt
@@ -28,7 +28,7 @@
rule "Scorecard @{context} rank code @{index}"
salience -5
when
- ScoreCard( modelName == "@{context}", $ranks : ranking, $keys : ranking.keySet() )
+ ScoreCard( modelName == "@{context}", $ranks : ranking, $keys : ranking.keySet() ) @watch( ranking )
then
String code = null;
View
23 drools-pmml/src/main/resources/org/drools/pmml/pmml_4_1/templates/models/scorecard/scorecardScoring.drlt
@@ -52,7 +52,7 @@ when
$sum : sum( $below ? ($base - $val) : ($val - $base) ) )
then
// System.out.println( "The CUMULATED score for code " + $code + " from set " + $set + " is >>> " + $sum );
- insertLogical( new CodeScore( $code, $sum.doubleValue() ) );
+ insertLogical( new CodeScore( $card, $code, $sum.doubleValue() ) );
end
@@ -60,22 +60,21 @@ rule "Detect Scorecard ReasonCode Change"
salience -12
when
$sc : ScoreCard( enableRC == true, $map : ranking )
- exists CodeScore( $c : code, score != $map.get( $c ) )
+ exists CodeScore( scoreCard == $sc, $c : code, score != $map.get( $c ) )
then
- insert( new ScoreRank( new java.util.LinkedHashMap() ) );
+ insert( new ScoreRank( $sc, new java.util.LinkedHashMap() ) );
end
-
rule "Sort Scorecard Reason Codes"
-salience -13
+salience -14
when
- $r : ScoreRank( $keys : rank.keySet() )
- $cs : CodeScore( $c : code not memberOf $keys, $s : score )
- not CodeScore( score > $s, code not memberOf $keys )
+ $r : ScoreRank( $sc : scoreCard, $map : rank )
+ $cs : CodeScore( scoreCard == $sc, ! $map.containsKey( code ), $s : score, $c : code )
+ not CodeScore( scoreCard == $sc, ! $map.containsKey( code ), score > $s )
then
- modify ( $r ) {
- getRank().put( $c, $s );
- }
+ $r.getRank().put( $c, $s );
+ modify ( $cs ) {}
+ modify ( $r ) {}
end
@@ -83,7 +82,7 @@ rule "Integrate Scorecard ReasonCode Map"
salience -15
when
$s : ScoreCard( enableRC == true )
- $x : ScoreRank( $map : rank )
+ $x : ScoreRank( scoreCard == $s, $map : rank )
then
retract( $x );
modify ( $s ) {
Please sign in to comment.
Something went wrong with that request. Please try again.