use of de.lmu.ifi.dbs.elki.result.FrequentItemsetsResult in project elki by elki-project.
the class EclatTest method testLarge.
@Test
public void testLarge() {
Database db = loadTransactions(UNITTEST + "itemsets/zutaten.txt.gz", 16401);
FrequentItemsetsResult res = //
new ELKIBuilder<>(Eclat.class).with(Eclat.Parameterizer.MINSUPP_ID, 200).build().run(db);
assertEquals("Size not as expected.", 184, res.getItemsets().size());
}
use of de.lmu.ifi.dbs.elki.result.FrequentItemsetsResult in project elki by elki-project.
the class Eclat method run.
/**
* Run the Eclat algorithm
*
* @param db Database to process
* @param relation Bit vector relation
* @return Frequent patterns found
*/
public FrequentItemsetsResult run(Database db, final Relation<BitVector> relation) {
// TODO: implement with resizable arrays, to not need dim.
final int dim = RelationUtil.dimensionality(relation);
final VectorFieldTypeInformation<BitVector> meta = RelationUtil.assumeVectorField(relation);
// Compute absolute minsupport
final int minsupp = getMinimumSupport(relation.size());
LOG.verbose("Build 1-dimensional transaction lists.");
Duration ctime = LOG.newDuration(STAT + "eclat.transposition.time").begin();
DBIDs[] idx = buildIndex(relation, dim, minsupp);
LOG.statistics(ctime.end());
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Building frequent itemsets", idx.length, LOG) : null;
Duration etime = LOG.newDuration(STAT + "eclat.extraction.time").begin();
final List<Itemset> solution = new ArrayList<>();
for (int i = 0; i < idx.length; i++) {
LOG.incrementProcessed(prog);
extractItemsets(idx, i, minsupp, solution);
}
LOG.ensureCompleted(prog);
Collections.sort(solution);
LOG.statistics(etime.end());
LOG.statistics(new LongStatistic(STAT + "frequent-itemsets", solution.size()));
return new FrequentItemsetsResult("Eclat", "eclat", solution, meta, relation.size());
}
Aggregations