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

apriori.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           apriori.h  -  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_H
00010 #define APRIORI_H
00011 
00012 //#include "itemset.h"
00013 #include "trie.h"
00014 #include "trie_hash.h"
00015 #include <map>
00016 
00017 
00022 class basket_comp
00023 {
00024 public:
00025         bool operator()(const vector<itemtype>& basket_1,const vector<itemtype>& basket_2) const
00026         {
00027                 itemtype item_index_1=0, item_index_2=0;
00028                 while (item_index_1<basket_1.size() && item_index_2<basket_2.size())
00029                         if (basket_1[item_index_1]<basket_2[item_index_2]) return true;
00030                         else if (basket_1[item_index_1]>basket_2[item_index_2]) return false;
00031                         else {item_index_1++;item_index_2++;}
00032                 if (item_index_1==basket_1.size() && item_index_2<basket_2.size()) return true;
00033                 else return false;
00034         }
00035 };
00036 
00086 class Apriori {
00087         Trie* trie;
00088         vector<itemtype> basket;
00089         unsigned long basket_number;
00090         map<vector<itemtype>,unsigned long,basket_comp> reduced_baskets;
00091         bool store_input;
00092 
00094         void read_in_a_line(FILE* filepoint);
00096         void support(FILE* filepoint, const itemtype& candidate_size);
00097 
00098 public:
00099   Apriori(const bool& store_input, const int& trie_type=1,const int& child_threshold=5);
00100 
00102   void APRIORI_alg(ofstream& outcomefile,const char* basket_filename, const double& min_supp, const double& min_conf);
00103 };
00104 
00105 #endif

Generated on Sun Dec 21 12:05:37 2003 for APRIORI algorithm by doxygen 1.3.4