00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef MSApriori_Trie_HPP
00010 #define MSApriori_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
00032 class MSApriori_Trie
00033 {
00034 public:
00035
00036 MSApriori_Trie( const unsigned long counter_of_emptyset, const vector<double>& mis_abs );
00037
00039 void insert_frequent_items( const set< pair<itemtype, unsigned long> >& counters );
00040
00041
00043 void candidate_generation( const itemtype& frequent_size );
00044
00046 void find_candidate( const vector<itemtype>& basket, const itemtype candidate_size, const unsigned long counter=1 );
00047
00049 void delete_infrequent( const itemtype candidate_size );
00050
00052 void association( const double min_conf, Input_Output_Manager& input_output_manager ) const;
00053
00055 itemtype longest_path() const;
00056
00058 void write_content_to_file( Input_Output_Manager& input_output_manager ) const;
00059
00061 void show_content_preorder( ) const;
00062
00063 ~MSApriori_Trie();
00064
00065 protected:
00066
00068 bool is_all_subset_frequent( const set<itemtype>& maybe_candidate ) const;
00069
00071 void candidate_generation_two( );
00072
00074 void candidate_generation_assist( Trie* Trie, const itemtype distance_from_generator,
00075 set<itemtype>& maybe_candidate );
00076
00078 void find_candidate_two( const vector<itemtype>& basket, const unsigned long counter=1 );
00079
00081 void delete_infrequent_two( );
00082
00083
00084 void assoc_rule_find( const double min_conf, set<itemtype>& condition_part, set<itemtype>& consequence_part, const unsigned long union_support, Input_Output_Manager& input_output_manager ) const;
00085
00086 void assoc_rule_assist( const double min_conf, const Trie* Trie, set<itemtype>& consequence_part, Input_Output_Manager& input_output_manager ) const;
00087
00089 void write_content_to_file_assist( Input_Output_Manager& input_output_manager, const Trie* actual_state, const itemtype distance_from_frequent, set<itemtype>& frequent_itemset ) const;
00090 private:
00091
00092
00093 public:
00094
00095
00096 protected:
00098 Trie main_trie;
00099
00106 vector< vector<unsigned long> > temp_counter_array;
00107
00113 vector<double> mis_abs;
00114 };
00115
00116 #endif