Package cs412.hw3.item

Examples of cs412.hw3.item.Item


    t.processFile("D:\\workspace\\CS412_HW3\\src\\train2.txt");
    t.returnNewFile("c:\\train2Modified2.txt");
  }
  private static void primePattern(Pattern p, Integer ...strings ){
    for(Integer s: strings){
      Item item = new Item(String.valueOf(s));
      p.insertItem(item);
    }
  }
View Full Code Here


        return bestPat;
      }
      for(FrequentPattern fpp: fp){
        System.out.println();
      }
      Item ai = child.getLabel();
      Pattern B = new Pattern(alpha);
      B.insertItem(ai);//with support = ai.support
      double ig_b = myDBRef.IG(B);
      boolean isCovered = myDBRef.isCovered(B);
      if(!isCovered){
View Full Code Here

//    System.out.println(tDB.IG(p));
//   
//    DDPMine m = new DDPMine(tDB,1);
//    List<Pattern> results = m.perform(t.getHeader());
//    System.out.println(results);
    Pattern pp = new Pattern();
    pp.insertItem(new Item("d"));
//    pp.insertItem(new Item("b"));
    ConditionalDB d = tDB.getConditionalDBForPattern(pp);
    FPTree tr = d.buildConditionalFPTree();
   
  }
View Full Code Here

  public static void main(String[] args){
    int max = 73;
    List<Pattern> pats = new ArrayList<Pattern>();
    Integer[][] patterns = new Integer[][]{{27,56}, {8,70,68,66,17,19,9,53,15,44,40,3,64,46,58,34,56,50,38,60,32,54,5,23,62,42,72,37,13,48,11,22,26,2}, {2,26,68,66,17,13,37,72,42,62,23,3,54,32,60,38,50,56,34,58,46,64,7,40,44,15,53,9,19,11,22,49,70}, {4,2,26,22,11,48,13,37,72,42,62,23,64,54,60,38,50,56,34,46,58,5,40,44,15,53,9,19,17,66,68,70,8}, {4,70,49,22,11,19,9,53,15,44,40,7,58,46,34,56,50,38,60,54,64,23,62,42,72,37,13,17,66,68,26,2}, {4,70,68,11,17,13,37,53,15,44,40,7,54,60,38,50,56,34,46,58,23,62,42,72,25,9,19,21,66,49,2}, {68,11,17,13,37,53,15,29,62,54,58,60,38,50,56,34,46,5,23,44,42,72,25,9,19,21,66}, {2,70,49,66,21,19,37,53,15,44,40,3,46,34,56,50,38,60,54,7,62,42,72,25,9,17,11,68,14,24}, {50}};
    for(int i = 0;i<patterns.length;i++){
      pats.add(new Pattern());
    }
   
    List<Pattern> results = new ArrayList<Pattern>();
    for(int i=0;i<pats.size();i++){
      primePattern(pats.get(i), patterns[i]);
View Full Code Here

    List<Pattern> Fs = new ArrayList<Pattern>();
    if(tree == null || tree.getChildren().isEmpty() || myDBRef.getTransactions().isEmpty()){//|| tree.getCount() <= 0){
      return Fs;
    }
    BranchAndBound bab = new BranchAndBound(myDBRef,htable);
    Pattern alpha = bab.branch_and_bound(tree,min_sup,null);
    if(alpha == null){
      // no patterns remain to be found under criteria
      return Fs;
    }
    List<Transaction> tidList= myDBRef.computeTIDList(alpha);
View Full Code Here

      }
      for(FrequentPattern fpp: fp){
        System.out.println();
      }
      Item ai = child.getLabel();
      Pattern B = new Pattern(alpha);
      B.insertItem(ai);//with support = ai.support
      double ig_b = myDBRef.IG(B);
      boolean isCovered = myDBRef.isCovered(B);
      if(!isCovered){
        return bestPat;
      }
View Full Code Here

  /** Builds a conditional FPTree from the transactions contained in this db.
   * @return
   */
  public FPTree buildConditionalFPTree() {
    ConditionalFPTreeBuilder builder = new ConditionalFPTreeBuilder(this,pattern);
    return builder.buildConditionalTree();
  }
View Full Code Here

    String fileName = args[0];
    r.processFile(fileName);
    Log.writeInfoDual(new Date()+" :Processed Transactions");
    Log.writeInfoDual(new Date()+" :Building FPTree...");
    FPTreeBuilder b = new FPTreeBuilder(db);
    FPTree t = b.buildTree();
    System.out.println(t.getCount());
    Log.writeInfoDual(new Date()+" :FPTree Built");
    Log.writeInfoDual(new Date()+" :Mining Patterns...");
    DDPMine m = new DDPMine(db,delta);
    List<Pattern> results = m.perform(t);
    DatasetTransformer optimusPrime = new DatasetTransformer(results,r.getLargestItemFound());
View Full Code Here

           //add this label to the list so we don't chop off part of the cond pat base until it's count has been calculated
           list.add(new Item(label));
           while(list.size() > 0){
            String tlabel = list.get(0).getItemName();
            list.remove(list.size()-1);
            FPTree temp = tree.getSubTreeByLabel(tlabel);
            for(int i = 1; i<list.size();i++){
              temp = temp.getSubTreeByLabel(list.get(i).getItemName());
            }
            if(temp.getCount() >= min_sup){
              Pattern newp = new Pattern();
              newp.insertItems(list);
              FrequentPattern newFP = new FrequentPattern(newp,temp.getCount());
              if(!newCFP.containsKey(label)){
                 newCFP.put(label, new ArrayList<FrequentPattern>());
               }
               newCFP.get(label).add(newFP);
              break;
View Full Code Here

  private static Hashtable<Transaction, FPTree> TID_Node_Map = new Hashtable<Transaction, FPTree>();
 
  private TIDMapping(){};
 
  public static void addTIDMapping(FPTree tree, Transaction tran){
    FPTree result = TID_Node_Map.put(tran,tree);
  }
View Full Code Here

TOP

Related Classes of cs412.hw3.item.Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.