Turi Create  4.0
turi::pattern_mining::fp_tree Class Reference

#include <toolkits/pattern_mining/fp_tree.hpp>

Public Member Functions

void prune_tree (const size_t &min_support)
 
std::vector< size_t > get_supports_at_depth (const size_t &depth) const
 
size_t get_support (const fp_tree_heading &heading, const size_t &min_depth=1) const
 
size_t get_num_transactions () const
 
std::vector< size_t > get_descendant_supports (fp_node *anchor_node)
 
virtual void add_transaction (const std::vector< size_t > &new_transaction, const size_t &count)
 
fp_tree_header get_cond_header (const fp_tree_heading &heading, const size_t &min_support) const
 
std::vector< std::pair< size_t, size_t > > get_cond_item_counts (const fp_tree_heading &heading) const
 
fp_tree build_cond_tree (const fp_tree_heading &heading, const size_t &min_support) const
 

Detailed Description

FP-Tree data structure Vars: root_node (pointer fp_node) - the root node of the tree root_prefix (vector of ids) - the prefix of the fp-tree header (fp_tree_header) - the header for the fp-tree. my_closed_node_count - data structure to raise min_support

See http://hanj.cs.illinois.edu/pdf/sigmod00.pdf http://web.engr.illinois.edu/~hanj/pdf/icdm02_topk.pdf and http://hanj.cs.illinois.edu/pdf/tkde05_tfp.pdf

Definition at line 43 of file fp_tree.hpp.

Member Function Documentation

◆ add_transaction()

virtual void turi::pattern_mining::fp_tree::add_transaction ( const std::vector< size_t > &  new_transaction,
const size_t &  count 
)
virtual

Add a transaction to the tree Args: new_transaction (vector of size_ts) - new itemset count (size_t) - repetitions of the transaction (should be positive)

Reimplemented in turi::pattern_mining::fp_top_k_tree.

◆ build_cond_tree()

fp_tree turi::pattern_mining::fp_tree::build_cond_tree ( const fp_tree_heading heading,
const size_t &  min_support 
) const

Construct the conditional fp-tree (fp-tree) for item id at the heading

The conditional fp-tree of item 'id' is the fp-tree constructed from transcations in the current fp-tree that contain more frequent items than 'id'.

Args: heading (fp_tree_heading) - the item heading of the conditional fp-tree min_support (size_t) - the minimum number of transactions required to be 'frequent'. Returns: cond_tree (fp_tree) - sorted vector of item ids.

◆ get_cond_header()

fp_tree_header turi::pattern_mining::fp_tree::get_cond_header ( const fp_tree_heading heading,
const size_t &  min_support 
) const

Get the header for a conditional fp-tree

The conditional fp-tree of item 'alpha' is the fp-tree constructed from transcations in the current fp-tree that contain more frequent items than 'alpha'. Note that only items with support greater than min_support (in the new subtree) are returned.

Args: heading (fp_tree_heading) - the item heading of the conditional fp-tree min_support (size_t) - the minimum number of transactions required to be 'frequent' Returns: cond_header (fp_tree-header) - header of conditional fp-tree

◆ get_cond_item_counts()

std::vector<std::pair<size_t, size_t> > turi::pattern_mining::fp_tree::get_cond_item_counts ( const fp_tree_heading heading) const

Get the item frequencies for a conditional fp-tree

Args: heading (fp_tree_heading) - the item heading of the conditional fp-tree Returns: item_counts (vector of size_t, size_t) - Vector of item id and counts of the conditional fp-tree

◆ get_descendant_supports()

std::vector<size_t> turi::pattern_mining::fp_tree::get_descendant_supports ( fp_node anchor_node)

Get the supports of descendant node of an anchor node Args: anchor_node (pointer to fp_node) Returns: supports (vector of size_t) the supports of the children nodes This vector is used to raise min_support.

◆ get_num_transactions()

size_t turi::pattern_mining::fp_tree::get_num_transactions ( ) const

Get total number of transactions in the current fp-tree.

◆ get_support()

size_t turi::pattern_mining::fp_tree::get_support ( const fp_tree_heading heading,
const size_t &  min_depth = 1 
) const

Get the support of the item in transactions below a depth

Args: heading (fp_tree_heading) - the item heading min_depth (size_t) - minimum depth in fp-tree (default is 1) Returns: support (size_t) the support (total count) of item id in the fp_tree (at min_depth)

◆ get_supports_at_depth()

std::vector<size_t> turi::pattern_mining::fp_tree::get_supports_at_depth ( const size_t &  depth) const

Get the support of all items at or below min_depth Args: min_depth (size_t) Returns: supports_at_depth (vector of size_t)

◆ prune_tree()

void turi::pattern_mining::fp_tree::prune_tree ( const size_t &  min_support)

Prune tree of items less than min_support Args: min_support (size_t) - new min_support to prune tree


The documentation for this class was generated from the following file: