00001
00002
00003
00004
00005
00006
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 <fstream>
00019 #include <set>
00020 #include <vector>
00021 #include <cstdio>
00022 using namespace std;
00023
00024
00035 class Apriori_Trie
00036 {
00037 public:
00038
00043 Apriori_Trie( const countertype counter_of_emptyset ):
00044 main_trie(counter_of_emptyset){}
00045
00047 void insert_frequent_items(const vector<countertype>& counters );
00048
00054 void candidate_generation( const itemtype& frequent_size,
00055 Input_Output_Manager& input_output_manager );
00056
00059 void find_candidate( const vector<itemtype>& basket,
00060 const itemtype candidate_size,
00061 const countertype counter=1 );
00062
00064 void delete_infrequent( const double min_occurrence,
00065 const itemtype candidate_size );
00066
00067
00069 bool is_there_any_candidate() const
00070 {
00071 return !main_trie.edgevector.empty();
00072 }
00073
00074 ~Apriori_Trie(){}
00075
00076 protected:
00077
00079 bool is_all_subset_frequent( const set<itemtype>& maybe_candidate ) const;
00080
00082 void candidate_generation_two();
00083
00085 void candidate_generation_assist(
00086 Trie* trie,
00087 set<itemtype>& maybe_candidate,
00088 Input_Output_Manager& input_output_manager);
00089
00091 void find_candidate_two( const vector<itemtype>& basket,
00092 const countertype counter=1 );
00093
00095 void delete_infrequent_two( const double min_occurrence );
00096
00097 private:
00098
00099
00100 public:
00101
00102
00103 protected:
00105 Trie main_trie;
00106
00113 vector< vector<countertype> > temp_counter_array;
00114 };
00115
00116 #endif