public class FPGrowth
extends java.lang.Object
The basic idea of the FP-growth algorithm can be described as a recursive elimination scheme: in a preprocessing step delete all items from the transactions that are not frequent individually, i.e., do not appear in a user-specified minimum number of transactions. Then select all transactions that contain the least frequent item (least frequent among those that are frequent) and delete this item from them. Recurse to process the obtained reduced (also known as projected) database, remembering that the item sets found in the recursion share the deleted item as a prefix. On return, remove the processed item from the database of all transactions and start over, i.e., process the second frequent item etc. In these processing steps the prefix tree, which is enhanced by links between the branches, is exploited to quickly find the transactions containing a given item and also to remove this item from the transactions after it has been processed.
| Constructor and Description |
|---|
FPGrowth(int[][] itemsets,
double minSupport)
Constructor.
|
FPGrowth(int[][] itemsets,
int minSupport)
Constructor.
|
FPGrowth(int[] frequency,
int minSupport)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int[] itemset)
Add an item set into the database.
|
java.util.List<ItemSet> |
learn()
Mines the frequent item sets.
|
long |
learn(java.io.PrintStream out)
Mines the frequent item sets.
|
int |
size()
Returns the number transactions in the database.
|
public FPGrowth(int[] frequency,
int minSupport)
add(int[]) during the second scan of the database.
In this way, we don't need load the whole database into the main memory.
In the database, the item identifiers have to be in [0, n), where n is
the number of items.frequency - the frequency of single items.minSupport - the required minimum support of item sets in terms
of frequency.public FPGrowth(int[][] itemsets,
double minSupport)
itemsets - the item set dataset. Each row is a item set, which
may have different length. The item identifiers have to be in [0, n),
where n is the number of items.minSupport - the required minimum support of item sets in terms
of percentage.public FPGrowth(int[][] itemsets,
int minSupport)
itemsets - the item set database. Each row is a item set, which
may have different length. The item identifiers have to be in [0, n),
where n is the number of items. Item set should NOT contain duplicated
items. Note that it is reordered after the call.minSupport - the required minimum support of item sets in terms
of frequency.public void add(int[] itemset)
itemset - an item set, which should NOT contain duplicated items.
Note that it is reordered after the call.public int size()
public java.util.List<ItemSet> learn()
public long learn(java.io.PrintStream out)
out - a print stream for output of frequent item sets.