Main Page | Namespace List | Class List | File List | Class Members | File Members

Apriori_Trie.hpp

Go to the documentation of this file.
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 <fstream>
00019 #include <set>
00020 #include <vector>
00021 #include <cstdio>
00022 using namespace std;
00023 
00024 
00035 class Apriori_Trie
00036 {
00037 public:
00038 
00039    Apriori_Trie( const unsigned long counter_of_emptyset );
00040    
00042    void insert_frequent_items(const vector<unsigned long>& counters );
00043    
00045    void candidate_generation( const itemtype& frequent_size );
00046 
00049    void find_candidate( const vector<itemtype>& basket, 
00050                         const itemtype candidate_size, 
00051                         const unsigned long counter=1 );
00052 
00054    void delete_infrequent( const double min_occurrence, 
00055                            const itemtype candidate_size );
00056 
00058    void association( const double min_conf, 
00059                      Input_Output_Manager& input_output_manager ) const;
00060 
00062    itemtype longest_path() const;
00063 
00065    void write_content_to_file( Input_Output_Manager& input_output_manager ) const;
00066 
00068    void show_content_preorder( ) const;
00069 
00070    ~Apriori_Trie();
00071 
00072 protected:
00073 
00075    bool is_all_subset_frequent( const set<itemtype>& maybe_candidate ) const;
00076 
00078    void candidate_generation_two();
00079 
00081    void candidate_generation_assist( Trie* Trie, 
00082                                      const itemtype distance_from_generator,
00083                                      set<itemtype>& maybe_candidate );
00084 
00086    void find_candidate_two( const vector<itemtype>& basket, 
00087                             const unsigned long counter=1 );
00088 
00090    void delete_infrequent_two( const double min_occurrence );
00091 
00092 
00093    void assoc_rule_find( const double min_conf, set<itemtype>& condition_part, 
00094                          set<itemtype>& consequence_part, 
00095                          const unsigned long union_support, 
00096                          Input_Output_Manager& input_output_manager ) const;
00097 
00098    void assoc_rule_assist( const double min_conf, const Trie* Trie, 
00099                            set<itemtype>& consequence_part, 
00100                            Input_Output_Manager& input_output_manager ) const;
00101 
00102    // Writes out the content of the Apriori_Trie
00104    void write_content_to_file_assist( Input_Output_Manager& input_output_manager, 
00105                                       const Trie* actual_state, 
00106                                       const itemtype distance_from_frequent, 
00107                                       set<itemtype>& frequent_itemset ) const;
00108 private:
00109    // No private methods
00110 
00111 public:
00112    // No public members
00113 
00114 protected:
00116    Trie main_trie;
00117 
00124    vector< vector<unsigned long> > temp_counter_array;
00125 };
00126 
00127 #endif

Generated on Mon Aug 16 19:59:29 2004 for APRIORI algorithm by doxygen 1.3.5