Package org.apache.mahout.fpm.pfpgrowth.fpgrowth

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


    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


    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);
    }
View Full Code Here

  private static void mergeHeap(FrequentPatternMaxHeap frequentPatterns, FrequentPatternMaxHeap returnedPatterns,
      int attribute, long count, boolean addAttribute) {
    frequentPatterns.addAll(returnedPatterns, attribute, count);
    if (frequentPatterns.addable(count) && addAttribute) {
      Pattern p = new Pattern();
      p.add(attribute, count);
      frequentPatterns.insert(p);
    }
  }
View Full Code Here

      prefixPats = mineSinglePrefix(p, k);
    }

    FrequentPatternMaxHeap suffixPats = new FrequentPatternMaxHeap(k, true);

    Pattern thisPat = new Pattern();
    thisPat.add(currentAttribute, currentAttributeCount);
    suffixPats.insert(thisPat);

    for (int attr : q.attrIterableRev())  {
      mergeHeap(suffixPats,
                growth(q, minSupportMutable, k, attr),
View Full Code Here

    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

    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);
    }
View Full Code Here

                                int attribute,
                                long count,
                                boolean addAttribute) {
    frequentPatterns.addAll(returnedPatterns, attribute, count);
    if (frequentPatterns.addable(count) && addAttribute) {
      Pattern p = new Pattern();
      p.add(attribute, count);
      frequentPatterns.insert(p);
    }
  }
View Full Code Here

  @Override
  public void collect(Integer key, FrequentPatternMaxHeap value) throws IOException {
    List<Pair<List<A>,Long>> perAttributePatterns = Lists.newArrayList();
    PriorityQueue<Pattern> t = value.getHeap();
    while (!t.isEmpty()) {
      Pattern itemSet = t.poll();
      List<A> frequentPattern = Lists.newArrayList();
      for (int j = 0; j < itemSet.length(); j++) {
        frequentPattern.add(reverseMapping.get(itemSet.getPattern()[j]));
      }
      Collections.sort(frequentPattern);
     
      Pair<List<A>,Long> returnItemSet = new Pair<List<A>,Long>(frequentPattern, itemSet.support());
      perAttributePatterns.add(returnItemSet);
    }
    Collections.reverse(perAttributePatterns);
   
    collector.collect(reverseMapping.get(key), perAttributePatterns);
View Full Code Here

      prefixPats = mineSinglePrefix(p, k);
    }

    FrequentPatternMaxHeap suffixPats = new FrequentPatternMaxHeap(k, true);

    Pattern thisPat = new Pattern();
    thisPat.add(currentAttribute, currentAttributeCount);
    suffixPats.insert(thisPat);

    for (int attr : q.attrIterableRev())  {
      mergeHeap(suffixPats,
                growth(q, minSupportMutable, k, attr, updater),
View Full Code Here

    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

TOP

Related Classes of org.apache.mahout.fpm.pfpgrowth.fpgrowth.Pattern

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.