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