Examples of FrequentPatternMaxHeap


Examples of org.apache.mahout.fpm.pfpgrowth.fpgrowth.FrequentPatternMaxHeap

   * in pPats and qPats. 
   */
  private static FrequentPatternMaxHeap cross(FrequentPatternMaxHeap pPats,
                                              FrequentPatternMaxHeap qPats,
                                              int k) {
    FrequentPatternMaxHeap pats = new FrequentPatternMaxHeap(k, true);

    for (Pattern p : pPats.getHeap()) {
      int[] pints = p.getPattern();
      for (Pattern q : qPats.getHeap()) {
        int[] qints = q.getPattern();
       
        Pattern pq = new Pattern();
        for (int pi = 0; pi < p.length(); pi++)
          pq.add(pints[pi], p.support());
        for (int qi = 0; qi < q.length(); qi++)
          pq.add(qints[qi], q.support());
        pats.insert(pq);
      }
    }

    for (Pattern q : qPats.getHeap()) {
      Pattern qq = new Pattern();
      int[] qints = q.getPattern();
      for (int qi = 0; qi < q.length(); qi++)
        qq.add(qints[qi], q.support());
      pats.insert(qq);
    }

    return pats;
  }
View Full Code Here

Examples of org.apache.mahout.fpm.pfpgrowth.fpgrowth.FrequentPatternMaxHeap

  /**
   * Mine all frequent patterns that can be created by following a prefix
   * that is common to all sets in the given tree.
   */
  private static FrequentPatternMaxHeap mineSinglePrefix(FPTree tree, int k) {
    FrequentPatternMaxHeap pats = new FrequentPatternMaxHeap(k, true);
    FPTree.FPNode currNode = tree.root();
    while (currNode.numChildren() == 1) {
      currNode = currNode.children().iterator().next();
      FrequentPatternMaxHeap singlePat = new FrequentPatternMaxHeap(k, true);
      Pattern p = new Pattern();
      p.add(currNode.attribute(), currNode.count());
      singlePat.insert(p);
      pats = cross(singlePat, pats, k);
      pats.insert(p);
    }

    return pats;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.