kaknikhil commented on a change in pull request #423: Association Rules: 
Improve performance
URL: https://github.com/apache/madlib/pull/423#discussion_r305944466
 
 

 ##########
 File path: src/modules/assoc_rules/assoc_rules.cpp
 ##########
 @@ -109,6 +117,29 @@ gen_rules_from_cfp::SRF_next(void *user_fctx, bool 
*is_last_call) {
         }
     }
 
+    // If the target max size is greater than the current number of elements to
+    // consider, there is no need to actually check for lhs or rhs sizes.
+
+    if (myfctx->max_LHS_size <= myfctx->num_elems ||
+        myfctx->max_RHS_size <= myfctx->num_elems){
+
+        int countLHS = 0;
+        int countRHS = 0;
+
+        // flags[i]=True means that element is on the lhs (and vice versa)
+        for (i = 0; i < myfctx->num_elems; ++i) {
+            if (!myfctx->flags[i]) {
+                countRHS ++;
+            } else {
+                countLHS ++;
+            }
+        }
+        if (countLHS > myfctx->max_LHS_size || countRHS > 
myfctx->max_RHS_size){
+            --myfctx->num_calls;
 
 Review comment:
   Can you explain this in a comment ? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to