FPGrowthObj<String> fp = new FPGrowthObj<String>();
String inputFilename = "FPGsynth.dat";
int minSupport = 50;
StringRecordIterator it = new StringRecordIterator(new FileLineIterable(Resources.getResource(
inputFilename).openStream()), "\\s+");
int patternCnt_10_13_1669 = 0;
int patternCnt_10_13 = 0;
while (it.hasNext()) {
Pair<List<String>,Long> next = it.next();
List<String> items = next.getFirst();
if (items.contains("10") && items.contains("13")) {
patternCnt_10_13++;
if (items.contains("1669")) {
patternCnt_10_13_1669++;
}
}
}
if (patternCnt_10_13_1669 < minSupport)
throw new IllegalStateException("the test is broken or data is missing ("
+ patternCnt_10_13_1669+", "
+ patternCnt_10_13+")");
final Map<Set<String>,Long> results = Maps.newHashMap();
Set<String> features_10_13 = new HashSet<String>();
features_10_13.add("10");
features_10_13.add("13");
Set<String> returnableFeatures = new HashSet<String>();
returnableFeatures.add("10");
returnableFeatures.add("13");
returnableFeatures.add("1669");
fp.generateTopKFrequentPatterns(
new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename).openStream()), "\\s+"),
fp.generateFList(new StringRecordIterator(new FileLineIterable(Resources.getResource(inputFilename)
.openStream()), "\\s+"), minSupport), minSupport, 100000,
returnableFeatures,
new OutputCollector<String,List<Pair<List<String>,Long>>>() {
@Override