00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00031 #ifndef HPOSMINER_H
00032 #define HPOSMINER_H
00033
00034
00035
00036 #include "HLevItemSetMap.h"
00037 #include "LevelwiseMiner.h"
00038
00039 struct hassoc
00040 {
00041 int code;
00042 unsigned int count;
00043 };
00044
00045 typedef map<ItemSet, struct hassoc> i_hmap;
00046 typedef i_hmap::iterator hm_iter;
00047 typedef i_hmap::const_iterator hm_citer;
00048
00055 class HPosMiner: public LevelwiseMiner
00056 {
00057 protected:
00058
00059 unsigned int current;
00060
00061
00062 float balance;
00063
00064
00065 unsigned int bpreq;
00066
00067
00068
00069
00070 unsigned int bpreq2;
00071
00072
00073 float support;
00074
00075
00076 vector<ItemSet> buffer;
00077
00078
00079 unsigned int buffer_size;
00080
00081
00082 LevItemSetMap<struct hassoc> keepSets;
00083
00084
00085 void analyzeHelper();
00086 virtual bool analyzeLevel(unsigned int level);
00087 virtual void analyzeFirstLevel();
00088 virtual void analyzeNewLevel(unsigned int level);
00089 virtual void countTable(unsigned int level, unsigned int length);
00090 virtual bool hasMatches(hm_citer i, hm_citer j, unsigned int level);
00091 virtual void pruneItemSets(const vector<unsigned int>& tallies,
00092 unsigned int level);
00093 virtual unsigned int handlePrinting(unsigned int level);
00094 virtual void analyzeItemSet(const ItemSet& is,
00095 const ItemSet& ispos, const ItemSet& isneg, unsigned int& penalty,
00096 unsigned int& success) const;
00097 virtual void analyzeItemSet(const ItemSet& is, unsigned int& penalty,
00098 unsigned int& success) const;
00099 int gensupp(const ItemSet& ispos, const ItemSet& isneg,
00100 unsigned int start) const;
00101 void setcode(const ItemSet& is, unsigned int code);
00102 void setcode(unsigned int code);
00103
00104 public:
00105 HPosMiner(float balance = 0.5, float support = 1.0,
00106 unsigned int buffer_size = 1000);
00107 HPosMiner(const HPosMiner& src);
00108 virtual ~HPosMiner();
00109 virtual HPosMiner& operator =(const HPosMiner& rhs);
00110 };
00111
00112 #endif