Biorithm
1.1
|
A class that implements the Apriori algorithm with "complements". The user passes a binary matrix to the constructor. For each row in the matrix, the constructor adds the complement of the row to the matrix. The computeItemsets() method computes itemsets in this augmented matrix with one constraint: every computed itemset will contain at least one original (non-complemented) row. Since most matrices are sparse (they contain very few ones), the complement rows contain a very large number of ones. There could be a very large number of itemsets containing only complement rows. This constraint prevents the algorithm from computing these itemsets. ! More...
#include <apriori.h>
Public Member Functions | |
AprioriWithComplement (vector< vector< unsigned int > > &matrix, map< unsigned int, string > &majorNames, map< unsigned int, string > &minorNames) | |
Constructor that reads a binary matrix from a file. | |
virtual | ~AprioriWithComplement () |
Destructor. | |
virtual void | computeItemsets (const set< unsigned int > *rowsToAvoidInSeed=NULL, const set< unsigned int > *rowsToAvoidCompletely=NULL) |
virtual AprioriLatticeEdgeType | computeLatticeEdgeType (const Itemset &itm1, const Itemset &itm2) const |
Protected Member Functions | |
virtual void | _computeAllRows (vector< unsigned int > &allRows) const |
virtual unsigned int | _computeRandomRows (const vector< unsigned int > &allRows, vector< unsigned int > &randomRows) const |
virtual bool | _isComplementRow (unsigned int index) const |
virtual unsigned int | _getOriginalRow (unsigned int index) const |
A class that implements the Apriori algorithm with "complements". The user passes a binary matrix to the constructor. For each row in the matrix, the constructor adds the complement of the row to the matrix. The computeItemsets() method computes itemsets in this augmented matrix with one constraint: every computed itemset will contain at least one original (non-complemented) row. Since most matrices are sparse (they contain very few ones), the complement rows contain a very large number of ones. There could be a very large number of itemsets containing only complement rows. This constraint prevents the algorithm from computing these itemsets. !
AprioriWithComplement::AprioriWithComplement | ( | vector< vector< unsigned int > > & | matrix, |
map< unsigned int, string > & | majorNames, | ||
map< unsigned int, string > & | minorNames | ||
) |
Constructor that reads a binary matrix from a file.
Create an instance of Apriori from a file. The file must be in the form of a tab delimited matrix with the first row containing the column names. Each row must begin with the row name. The first token of the first row must exist, but can be any value.
void AprioriWithComplement::computeItemsets | ( | const set< unsigned int > * | rowsToAvoidInSeed = NULL , |
const set< unsigned int > * | rowsToAvoidCompletely = NULL |
||
) | [virtual] |
Compute closed itemsets in the data using the Apriori algorithm.
[in] | rowsToAvoidInSeed,a | pointer to a set of rows to avoid when computing single-row itemsets. The method starts by computing itemsets with single rows. If a row is a member of this set, the method will not use that row to compute a single-row itemset. The row may be used later in computing itemsets with more than one row. |
[in] | rowsToAvoidCompletely,a | pointer to a set of rows to avoid when computing any itemset, including single-row itemsets. |
Reimplemented from Apriori.
AprioriLatticeEdgeType AprioriWithComplement::computeLatticeEdgeType | ( | const Itemset & | itm1, |
const Itemset & | itm2 | ||
) | const [virtual] |
Compute the type of the edge between two itemsets.
Reimplemented from Apriori.