示例#1
0
  private void generateLarge(ArrayList<Itemset> Lk, int clas) {
    int i, j, size;
    ArrayList<Itemset> Lnew;
    Itemset newItemset, itemseti, itemsetj;

    size = Lk.size();

    if (size > 1) {
      if (((Lk.get(0)).size() < this.nVariables) && ((Lk.get(0)).size() < this.depth)) {
        Lnew = new ArrayList<Itemset>();

        for (i = 0; i < size - 1; i++) {
          itemseti = Lk.get(i);
          for (j = i + 1; j < size; j++) {
            itemsetj = Lk.get(j);
            if (this.isCombinable(itemseti, itemsetj)) {
              newItemset = itemseti.clone();
              newItemset.add((itemsetj.get(itemsetj.size() - 1)).clone());
              newItemset.calculateSupports(this.dataBase, this.train);
              if (newItemset.getSupportClass()[0] >= this.minsup) Lnew.add(newItemset);
            }
          }

          this.generateRules(Lnew, clas);
          this.generateLarge(Lnew, clas);
          Lnew.clear();
          System.gc();
        }
      }
    }
  }
示例#2
0
  private void generateL2(int clas) {
    int i, j, k, uncover;
    Item item;
    Itemset itemset;

    this.L2.clear();
    itemset = new Itemset(clas);

    for (i = 0; i < this.nVariables; i++) {
      if (this.dataBase.numLabels(i) > 1) {
        for (j = 0; j < this.dataBase.numLabels(i); j++) {
          item = new Item(i, j);
          itemset.add(item);
          itemset.calculateSupports(this.dataBase, this.train);
          if (itemset.getSupportClass()[0] >= this.minsup) this.L2.add(itemset.clone());
          itemset.remove(0);
        }
      }
    }

    this.generateRules(this.L2, clas);
  }