Package cs412.hw3.item

Examples of cs412.hw3.item.Item


  public int getLargestItemFound(){
    return largestItemFound;
  }
 
  public static void main(String args[]){
    TransactionDB db = new TransactionDB(1);
    InputFileReader r = new InputFileReader(db);
    r.processFile("D:\\workspace\\CS412_HW3\\src\\train1.txt");
    System.out.println(db.getTransactions().size());
  }
View Full Code Here


      System.out.println(" Log file will be created in current directory under file name: Jason_DDP_MINE_LOG**.txt where ** is Hour_Minute_Month_Day");
      System.exit(1);
    }
    int min_sup = 6;
    int delta = 2;
    TransactionDB db = new TransactionDB(min_sup);
    InputFileReader r = new InputFileReader(db);
    Log.writeInfoDual(new Date()+" :Processing Transactions...");
    String fileName = args[0];
    r.processFile(fileName);
    Log.writeInfoDual(new Date()+" :Processed Transactions");
View Full Code Here

    trans.add( new Transaction(2,"1","d","o","n","k","e","y"));
    trans.add( new Transaction(3,"1","m","a","k","e"));
    trans.add( new Transaction(4,"0","m","u","c","k","y"));
    trans.add( new Transaction(5,"0","c","o","o","k","i","e"));
    int min_sup = 3;
    TransactionDB db = new TransactionDB(min_sup);
    db.addTransactions(trans);
    FPTreeBuilder builder = new FPTreeBuilder(db);
   
    FPTree mainTree = builder.buildTree();
   
    Hashtable<String, List<FrequentPattern>> f = FrequentPatternBuilder.buildConditionalPatternBase(mainTree.getHeader());
View Full Code Here

        tranItem.add(itemName);
        if(hash.containsKey(itemName)){
          hash.get(itemName).incrementSupport();
        }
        else{
          hash.put(itemName, new FrequentItem(itemName,1));
        }
      }
    }
    List<FrequentItem> sorted = Collections.list(Collections.enumeration(hash.values()));
    Collections.sort(sorted, new Comparator<FrequentItem>() {
View Full Code Here

    StringTokenizer t = new StringTokenizer(line);
    List<Item> items = new ArrayList<Item>();
   
    while(t.countTokens() > 1){
      String item = t.nextToken();
      items.add(new Item(item));
    }
   
    // record the max value found for svm preperation
    Item i = Collections.max(items, new Comparator<Item>() {
   
      public int compare(Item o1, Item o2) {
        return Integer.valueOf(o1.getItemName()).compareTo(Integer.valueOf(o2.getItemName()));
      }
   
    });
    int largest = Integer.valueOf(i.getItemName()).intValue();
    if(Double.isNaN(largestItemFoundInit) ||  largest > largestItemFound){
      largestItemFound = largest;
    }
    String classLabel = t.nextToken();
    Transaction tran = new Transaction(TID++,classLabel,items);
View Full Code Here

          // min sup is not met, so chop off patterns until we meet min sup
           else{ //count < min_sup
           Pattern freqpat = fp.getPattern();
           List<Item> list = freqpat.getPatternBase();
           //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++){
View Full Code Here

//   
//    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 Transaction(int tid,String classLabel,String ... item){
    this.tid = tid;
    this.classLabel = classLabel;
    for(int i=0;i<item.length;i++){
      items.add(new Item(item[i]));
    }
  }
View Full Code Here

   * @param maxPatternValue
   */
  private void primePatternMappings(int maxPatternValue){
    int nextIntForMap = ++maxPatternValue;
    for(Pattern p : frequentPatterns){
      Item i = new Item(String.valueOf(nextIntForMap++));
      frequentPatternMappings.put(p, i);
    }
  }
View Full Code Here

    // consider removing and making part of the inputFileReader
    StringTokenizer t = new StringTokenizer(line);
    List<Item> items = new ArrayList<Item>();
   
    while(t.countTokens() > 1){
      items.add(new Item(t.nextToken()));
    }

    String classLabel = t.nextToken();
    Transaction tran = new Transaction(TID++,classLabel,items);
    return tran;
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.