Package org.apache.mahout.fpm.pfpgrowth.convertors.string

Examples of org.apache.mahout.fpm.pfpgrowth.convertors.string.TopKStringPatterns


        pattern.add(featureReverseMap.get(i));
      }
      stringValues.add(new Pair<List<String>,Long>(pattern, e.getSecond()));
    }
   
    collector.collect(new Text(stringKey), new TopKStringPatterns(stringValues));
  }
View Full Code Here


    for (Pair<List<String>,Long> pattern : values.getPatterns()) {
      for (String item : pattern.getFirst()) {
        List<Pair<List<String>,Long>> patternSingularList = Lists.newArrayList();
        patternSingularList.add(pattern);
        context.setStatus("Aggregator Mapper:Grouping Patterns for " + item);
        context.write(new Text(item), new TopKStringPatterns(patternSingularList));
      }
    }
   
  }
View Full Code Here

  private int maxHeapSize = 50;
 
  @Override
  protected void reduce(Text key, Iterable<TopKStringPatterns> values, Context context) throws IOException,
                                                                                       InterruptedException {
    TopKStringPatterns patterns = new TopKStringPatterns();
    for (TopKStringPatterns value : values) {
      context.setStatus("Aggregator Reducer: Selecting TopK patterns for: " + key);
      patterns = patterns.merge(value, maxHeapSize);
    }
    context.write(key, patterns);
   
  }
View Full Code Here

      }
      stringValues.add(new Pair<List<String>, Long>(pattern, e.getSecond()));
    }

    collector
        .collect(new Text(StringKey), new TopKStringPatterns(stringValues));
  }
View Full Code Here

  public static List<Pair<String, TopKStringPatterns>> readFrequentPattern(
      FileSystem fs, Configuration conf, Path path) throws IOException {

    List<Pair<String, TopKStringPatterns>> ret = new ArrayList<Pair<String, TopKStringPatterns>>();
    Text key = new Text();
    TopKStringPatterns value = new TopKStringPatterns();
    SequenceFile.Reader reader = new SequenceFile.Reader(fs, path, conf);
    // key is feature value is count
    while (reader.next(key, value)) {
      ret.add(new Pair<String, TopKStringPatterns>(key.toString(),
          new TopKStringPatterns(value.getPatterns())));
    }
    return ret;
  }
View Full Code Here

      for (String item : pattern.getFirst()) {
        List<Pair<List<String>, Long>> patternSingularList = new ArrayList<Pair<List<String>, Long>>();
        patternSingularList.add(pattern);
        context.setStatus("Aggregator Mapper:Grouping Patterns for "+item);
        context.write(new Text(item),
            new TopKStringPatterns(patternSingularList));
      }
    }

  }
View Full Code Here

  private int maxHeapSize = 50;

  @Override
  protected void reduce(Text key, Iterable<TopKStringPatterns> values,
      Context context) throws IOException, InterruptedException {
    TopKStringPatterns patterns = new TopKStringPatterns();
    for (TopKStringPatterns value : values) {
      context.setStatus("Aggregator Reducer: Selecting TopK patterns for: " + key);
      patterns = patterns.merge(value, maxHeapSize);
    }
    context.write(key, patterns);

  }
View Full Code Here

    List<Pair<String,TopKStringPatterns>> ret = new ArrayList<Pair<String,TopKStringPatterns>>();
    // key is feature value is count
    for (Pair<Writable,TopKStringPatterns> record
         : new SequenceFileIterable<Writable,TopKStringPatterns>(path, true, conf)) {
      ret.add(new Pair<String,TopKStringPatterns>(record.getFirst().toString(),
                                                  new TopKStringPatterns(record.getSecond().getPatterns())));
    }
    return ret;
  }
View Full Code Here

  private int maxHeapSize = 50;
 
  @Override
  protected void reduce(Text key, Iterable<TopKStringPatterns> values, Context context) throws IOException,
                                                                                       InterruptedException {
    TopKStringPatterns patterns = new TopKStringPatterns();
    for (TopKStringPatterns value : values) {
      context.setStatus("Aggregator Reducer: Selecting TopK patterns for: " + key);
      patterns = patterns.merge(value, maxHeapSize);
    }
    context.write(key, patterns);
   
  }
View Full Code Here

    List<Pair<String,TopKStringPatterns>> ret = Lists.newArrayList();
    // key is feature value is count
    for (Pair<Writable,TopKStringPatterns> record
         : new SequenceFileIterable<Writable,TopKStringPatterns>(path, true, conf)) {
      ret.add(new Pair<String,TopKStringPatterns>(record.getFirst().toString(),
                                                  new TopKStringPatterns(record.getSecond().getPatterns())));
    }
    return ret;
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.fpm.pfpgrowth.convertors.string.TopKStringPatterns

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.