Ejemplo n.º 1
0
 def add_item_set(self, item_set):
     item = None
     antecedent = [None for x in range(self.n_variables)]  # int array
     for i in range(0, self.n_variables):
         antecedent[i] = -1  # do not care
     for i in range(0, item_set.size()):
         item = item_set.get_item(i)
         antecedent[item.get_variable()] = item.get_value()
     print("Init rule with parameter 2 begin ......")
     rule_here = Rule(2, self.dataBase)
     rule_here.asignaAntecedente(antecedent)
     rule_here.setConsequent(item_set.get_class_type())
     rule_here.setConfidence(item_set.get_support_class() /
                             item_set.get_support())
     rule_here.setSupport(item_set.get_support_class())
     print(
         " add a new rule,rule_here, in add_item_set, the conf of the rule is :"
         + str(rule_here.conf))
     self.rule_base_array.append(rule_here)