00001 /*************************************************************************** 00002 Apriori_Trie.hpp - description 00003 ------------------- 00004 begin : cs dec 26 2002 00005 copyright : (C) 2002 by Ferenc Bodon 00006 email : bodon@mit.bme.hu 00007 ***************************************************************************/ 00008 00009 #ifndef Apriori_Trie_HPP 00010 #define Apriori_Trie_HPP 00011 00016 #include "Trie.hpp" 00017 #include "Input_Output_Manager.hpp" 00018 #include <set> 00019 #include <vector> 00020 using namespace std; 00021 00022 00033 class Apriori_Trie 00034 { 00035 public: 00036 00037 Apriori_Trie( const unsigned long counter_of_emptyset ); 00038 00040 void insert_frequent_items(const vector<unsigned long>& counters ); 00041 00043 void candidate_generation( const itemtype& frequent_size, 00044 Input_Output_Manager& input_output_manager ); 00045 00048 void find_candidate( const vector<itemtype>& basket, 00049 const itemtype candidate_size, 00050 const unsigned long counter=1 ); 00051 00053 void delete_infrequent( const unsigned long min_occurrence, 00054 const itemtype candidate_size ); 00055 bool is_there_any_candidate() const; 00056 void statistics() const; 00057 00058 ~Apriori_Trie(); 00059 00060 protected: 00061 00063 bool is_all_subset_frequent( const set<itemtype>& maybe_candidate ) const; 00064 00066 void candidate_generation_two(); 00067 00069 void candidate_generation_assist( Trie* Trie, 00070 const itemtype distance_from_generator, 00071 set<itemtype>& maybe_candidate, 00072 Input_Output_Manager& input_output_manager ); 00073 00075 void find_candidate_two( const vector<itemtype>& basket, 00076 const unsigned long counter=1 ); 00077 00079 void delete_infrequent_two( const unsigned long min_occurrence ); 00080 00081 private: 00082 // No private methods 00083 00084 public: 00085 // No public members 00086 00087 protected: 00089 Trie main_trie; 00090 00097 vector< vector<unsigned long> > temp_counter_array; 00098 vector<unsigned long> nr_of_freq_itemsets; 00099 }; 00100 00101 #endif