Package smile.association
Class FPTree
java.lang.Object
smile.association.FPTree
FP-tree data structure used in FP-growth (frequent pattern growth)
algorithm for frequent item set mining. An FP-tree is basically a
prefix tree for the transactions. That is, each path represents a
set of transactions that share the same prefix, each node corresponds
to one item. In addition, all nodes referring to the same item are
linked together in a list, so that all transactions containing a specific
item can easily be found and counted by traversing this list.
The list can be accessed through a head element, which also
states the total number of occurrences of the item in the
database.
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the required minimum support of item sets in terms of frequency.static FPTree
of
(double minSupport, int[][] itemsets) One-step construction of FP-tree if the database is available in main memory.static FPTree
One-step construction of FP-tree if the database is available as stream.static FPTree
of
(int minSupport, int[][] itemsets) One-step construction of FP-tree if the database is available in main memory.static FPTree
One-step construction of FP-tree if the database is available as stream.int
size()
Returns the number transactions in the database.
-
Method Details
-
of
One-step construction of FP-tree if the database is available as stream.- Parameters:
minSupport
- the required minimum support of item sets in terms of frequency.supplier
- a supplier provides an itemset stream. For example, a code block to open a file and parse lines into a stream of itemsets. This function will be called twice.- Returns:
- a full built FP-tree.
-
of
One-step construction of FP-tree if the database is available as stream.- Parameters:
minSupport
- the required minimum support of item sets in terms of percentage.supplier
- a supplier provides an itemset stream. For example, a code block to open a file and parse lines into a stream of itemsets. This function will be called twice.- Returns:
- a full built FP-tree.
-
of
One-step construction of FP-tree if the database is available in main memory.- Parameters:
minSupport
- the required minimum support of item sets in terms of frequency.itemsets
- the item set database. Each row is an 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.- Returns:
- a full built FP-tree.
-
of
One-step construction of FP-tree if the database is available in main memory.- Parameters:
minSupport
- the required minimum support of item sets in terms of percentage.itemsets
- the item set database. Each row is an 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.- Returns:
- a full built FP-tree.
-
size
public int size()Returns the number transactions in the database.- Returns:
- the number transactions in the database.
-
minSupport
public int minSupport()Returns the required minimum support of item sets in terms of frequency.- Returns:
- the minimum support.
-