6 #ifndef TURI_FP_RESULTS_TREE_H 7 #define TURI_FP_RESULTS_TREE_H 16 #include <core/data/sframe/gl_sframe.hpp> 17 #include <core/data/sframe/gl_sarray.hpp> 19 #include <toolkits/feature_engineering/topk_indexer.hpp> 20 #include <toolkits/feature_engineering/statistics_tracker.hpp> 22 #include <toolkits/pattern_mining/fp_node.hpp> 23 #include <toolkits/pattern_mining/fp_tree.hpp> 24 #include <core/util/dense_bitset.hpp> 27 namespace pattern_mining {
46 std::map<size_t, size_t> id_order_map;
47 std::map<size_t, fp_node*> hash_id_map;
48 std::shared_ptr<fp_node> root_node =
nullptr;
66 const std::string & prefix = oarc.get_prefix();
67 closed_itemsets.
save(prefix);
76 size_t num_transactions = 0;
81 root_node = std::make_shared<fp_node>(ROOT_ID, 0);
82 root_node->item_count = num_transactions;
85 const std::string & prefix = iarc.get_prefix();
102 const size_t& support)
const;
111 virtual void add_itemset(
const std::vector<size_t>& potential_itemset, \
112 const size_t& support);
130 const std::shared_ptr<topk_indexer>& indexer =
nullptr)
const;
145 const size_t& top_k = TOP_K_MAX,
146 const size_t& min_length = 1)
const;
162 const size_t& min_length = 1,
163 const std::shared_ptr<topk_indexer>& indexer =
nullptr)
const;
172 std::vector<size_t>
sort_itemset(
const std::vector<size_t>& itemset)
const;
185 size_t get_support(
const std::vector<size_t>& sorted_itemset, \
186 const size_t& lower_bound_on_support = 0)
const;
215 bool is_subset_on_path(
const std::vector<size_t>& sorted_itemset, \
221 std::ostream& operator<<(std::ostream& out,
const fp_results_tree& tree);
227 flex_list itemset_to_flex_list(
const std::vector<size_t>& itemset, \
228 const std::shared_ptr<topk_indexer>& indexer =
nullptr);
248 std::priority_queue<size_t, std::vector<size_t>, std::greater<size_t>>
253 const size_t& k = TOP_K_MAX,
const size_t& length = 1);
261 size_t num_transactions = root_node->item_count;
269 const std::string & prefix = oarc.get_prefix();
270 closed_itemsets.
save(prefix);
278 size_t num_transactions = 0;
285 root_node = std::make_shared<fp_node>(ROOT_ID, 0);
286 root_node->item_count = num_transactions;
289 const std::string & prefix = iarc.get_prefix();
301 void add_itemset(
const std::vector<size_t>& potential_itemset, \
302 const size_t& support);
310 size_t get_min_support_bound();
318 void insert_support(
const size_t& support);
330 const std::shared_ptr<topk_indexer>& indexer =
nullptr)
const;
std::vector< size_t > sort_itemset(const std::vector< size_t > &itemset) const
bool is_itemset_redundant(const std::vector< size_t > &potential_itemset, const size_t &support) const
gl_sframe get_closed_itemsets(const std::shared_ptr< topk_indexer > &indexer=nullptr) const
void save(oarchive &oarc) const
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
virtual void add_itemset(const std::vector< size_t > &potential_itemset, const size_t &support)
void save(oarchive &oarc) const
size_t get_num_transactions() const
gl_sframe get_top_k_closed_itemsets(const size_t &top_k=TOP_K_MAX, const size_t &min_length=1, const std::shared_ptr< topk_indexer > &indexer=nullptr) const
void save(const std::string &path, const std::string &format="") const
void prune_tree(const size_t &min_support)
std::vector< dense_bitset > get_top_k_closed_bitsets(const size_t &size, const size_t &top_k=TOP_K_MAX, const size_t &min_length=1) const
size_t get_support(const std::vector< size_t > &sorted_itemset, const size_t &lower_bound_on_support=0) const
void load(iarchive &iarc)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
std::vector< flexible_type > flex_list
void load(iarchive &iarc)
void build_tree(const gl_sframe &closed_itemsets)