FPGrowth<String> fp1 = new FPGrowth<String>();
final Map<Set<String>,Long> results1 = Maps.newHashMap();
fp1.generateTopKFrequentPatterns(
new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename).openStream()), "\\s+"),
fp1.generateFList(new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename)
.openStream()), "\\s+"), minSupport), minSupport, 1000000,
returnableFeatures,
new OutputCollector<String,List<Pair<List<String>,Long>>>() {
@Override
public void collect(String key, List<Pair<List<String>,Long>> value) {
for (Pair<List<String>,Long> v : value) {
List<String> l = v.getFirst();
results1.put(new HashSet<String>(l), v.getSecond());
System.out.println("found pat ["+v.getSecond()+"]: "+ v.getFirst());
}
}
}, new StatusUpdater() {
@Override
public void update(String status) {}
});
FPGrowthObj<String> fp2 = new FPGrowthObj<String>();
final Map<Set<String>,Long> initialResults2 = Maps.newHashMap();
fp2.generateTopKFrequentPatterns(
new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename).openStream()), "\\s+"),
fp2.generateFList(new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename)
.openStream()), "\\s+"), minSupport), minSupport, 1000000,
new HashSet<String>(),
new OutputCollector<String,List<Pair<List<String>,Long>>>() {
@Override