[rules-users] PMML - Exception excuting consequence for rule xxx in yyy: java.lang.NullPointerException : using KnowledgeAgent

smilk sunghee.bae at meritz.co.kr
Wed Jul 17 20:43:35 EDT 2013


        count = new java.util.HashMap();
             count.put( "N", 93.0 );  count.put( "Y", 66.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.584905660377358 );  confs.put( "Y",
0.415094339622642 ); 

        node = new TreeNode( "RPart_Model",
                             "214",
                             "107",
                             java.util.Arrays.asList(  ),
                             "N",
                             159,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 709.0 );  count.put( "Y", 349.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.670132325141777 );  confs.put( "Y",
0.329867674858223 ); 

        node = new TreeNode( "RPart_Model",
                             "106",
                             "53",
                             java.util.Arrays.asList(  ),
                             "N",
                             1058,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 418.0 );  count.put( "Y", 112.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.788679245283019 );  confs.put( "Y",
0.211320754716981 ); 

        node = new TreeNode( "RPart_Model",
                             "52",
                             "26",
                             java.util.Arrays.asList(  ),
                             "N",
                             530,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 1642.0 );  count.put( "Y", 313.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.839897698209719 );  confs.put( "Y",
0.160102301790281 ); 

        node = new TreeNode( "RPart_Model",
                             "12",
                             "6",
                             java.util.Arrays.asList(  "24" , "25"  ),
                             "N",
                             1955,
                             count,
                             confs,
                             "24"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 6.0 );  count.put( "Y", 22.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.214285714285714 );  confs.put( "Y",
0.785714285714286 ); 

        node = new TreeNode( "RPart_Model",
                             "25",
                             "12",
                             java.util.Arrays.asList(  ),
                             "Y",
                             28,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 1636.0 );  count.put( "Y", 291.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.848988064348729 );  confs.put( "Y",
0.151011935651271 ); 

        node = new TreeNode( "RPart_Model",
                             "24",
                             "12",
                             java.util.Arrays.asList(  ),
                             "N",
                             1927,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
        count = new java.util.HashMap();
             count.put( "N", 65155.0 );  count.put( "Y", 422.0 ); 
        confs = new java.util.HashMap();
             confs.put( "N", 0.993564816932766 );  confs.put( "Y",
0.00643518306723394 ); 

        node = new TreeNode( "RPart_Model",
                             "2",
                             "1",
                             java.util.Arrays.asList(  ),
                             "N",
                             65577,
                             count,
                             confs,
                             "null"
                             );
        insertLogical( node );
    
end


rule "Ensure Tree Statistics are Filled"
dialect "mvel"
when
    $node : TreeNode( $id : id, $master : counts, $confs : confidence,
counts.size() == 0, $children : children, $numChi : children.size() )

    accumulate( TreeNode( id memberOf $children, counts.size() > 0, $sub :
counts, $x : recordCount )
                and $k : String() from $sub.keySet(),
                          $keys : collectSet( $k );
                          $keys.size() > 0 )
    accumulate( TreeNode( id memberOf $children, $sub : counts, $x :
recordCount > 0 ),
                          $subs : collectList( $sub ),
                          $num  : count( $sub ),
                          $tot  : sum( $x )
                          )
    $map : java.util.Map() from accumulate ( $kj : String() from $keys
                 and accumulate( $m : Map() from $subs, $x : sum( $m[ $kj ]
!= null ? $m[ $kj ] : 0 ) ),
        init( java.util.Map mapp = new java.util.HashMap() ),
        action( mapp.put( $kj, $x ); ),
        result( mapp )
    )
    $mpc : java.util.Map() from accumulate ( $kj : String() from $keys,
        init( java.util.Map mapc = new java.util.HashMap() ),
        action( mapc.put( $kj, $map[ $kj ] / $tot ); ),
        result( mapc )
    )
then
	System.out.println("Ensure Tree Statistics are Filled mvel 1");
    modify ( $node ) {
        getCounts().putAll( $map ),
        getConfidence().putAll( $mpc ),
        setRecordCount( $tot.intValue() );
    }
    System.out.println("Ensure Tree Statistics are Filled mvel 2");
end


rule "Ensure Tree Scores are Filled"
dialect "mvel"
when	
    $node : TreeNode( $id : id, outcome == null, confidence.size() > 0,
$conf : confidence )
    accumulate( $k : String() from $conf.keySet(),
                     $maxConf : max( $conf[ $k ] ) )
    java.util.Map.Entry( $best : key, value == $maxConf ) from
$conf.entrySet()

then
	System.out.println("Ensure Tree Scores are Filled mvel 1");
    modify ( $node ) {
        setOutcome( (java.lang.String) $best );
    }
    System.out.println("Ensure Tree Scores are Filled mvel 2");
end


 declare trait RPart_ModelInput

     
        AC_CSE_TYP_RE   :  java.lang.String
     
        AC_TYP_RE   :  java.lang.String
     
        COV_CD_RE   :  java.lang.String
     
        HDCAP_RATE_RE   :  java.lang.String
     
        AC_STAT_CD_RE   :  java.lang.String
     
        FDS_AC_YN   :  java.lang.String
     
        AGE_GRD   :  java.lang.String
     
        AC_COT_DAY   :  double
     

 end



--
View this message in context: http://drools.46999.n3.nabble.com/PMML-Exception-excuting-consequence-for-rule-xxx-in-yyy-java-lang-NullPointerException-using-Knowledt-tp4024963p4025001.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list