Пример #1
0
 /**
  * It substracts the instances covered by a rule from this dataset; i.e., it deactivates the
  * instances covered by that rule.
  *
  * @param mask Mask the mask with the active entries of the dataset
  * @param rule Rule the rule
  */
 public void substract(Mask mask, Rule rule) {
   mask.resetIndex();
   while (mask.next()) {
     boolean seguir = true;
     for (int i = 0; i < rule.size() && seguir; i++) {
       int A = rule.getSimpleRule(i).getAttribute();
       double V = rule.getSimpleRule(i).getValue();
       int operator = rule.getSimpleRule(i).getOperator();
       if (((Itemset) itemsets.elementAt(mask.getIndex())).isMissing(A)) {
         seguir = false;
       } else {
         if (operator == Rule.EQUAL)
           seguir = (((Itemset) itemsets.elementAt(mask.getIndex())).getValue(A) == V);
         if (operator == Rule.GREATER)
           seguir = (((Itemset) itemsets.elementAt(mask.getIndex())).getValue(A) > V);
         if (operator == Rule.LOWER)
           seguir = (((Itemset) itemsets.elementAt(mask.getIndex())).getValue(A) <= V);
       }
     }
     if (seguir) mask.reset();
   }
 }
Пример #2
0
 /**
  * It filters the instances covered by a rule from this dataset; i.e., it deactivates the
  * instances not covered by that rule.
  *
  * @param mask Mask the mask with the active entries of the dataset
  * @param rule Rule the rule
  */
 public void filter(Mask mask, Rule rule) {
   for (int i = 0; i < rule.size(); i++) this.filter(mask, rule.getSimpleRule(i));
 }