Biorithm  1.1
 All Classes Functions Variables Typedefs Friends
SPMiner.h
00001 /**************************************************************************
00002  * Copyright (c) 2007 Clifford Conley Owens III                           *
00003  *                                                                        *
00004  * This file is part of Biorithm.                                         *
00005  *                                                                        *
00006  * Biorithm is free software: you can redistribute it and/or modify       *
00007  * it under the terms of the GNU General Public License as published by   *
00008  * the Free Software Foundation, either version 3 of the License, or      *
00009  * (at your option) any later version.                                    *
00010  *                                                                        *
00011  * Biorithm is distributed in the hope that it will be useful,            *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00014  * GNU General Public License for more details.                           *
00015  *                                                                        *
00016  * You should have received a copy of the GNU General Public License      *
00017  * along with Biorithm.  If not, see <http://www.gnu.org/licenses/>.      *
00018  *                                                                        *
00019  **************************************************************************/
00020 
00031 #ifndef SPMINER_H
00032 #define STANDARDMINER_H
00033 
00034 // ---------------------------- Internal Headers ---------------------------- //
00035 
00036 #include "ItemSetMap.h"
00037 #include "LevelwiseMiner.h"
00038 
00045 class SPMiner: public LevelwiseMiner
00046 {
00047     protected:
00048         // Used for giving status messages
00049         unsigned int current;
00050 
00051         // The fraction of the rows that must comprise each bitpattern
00052         float balance;
00053 
00054         // The required number of occurances for each bitpattern
00055         unsigned int bpreq;
00056 
00057         // This is twice the required number of occurances for each bitpattern
00058         // it may seems redundant, but it is nice to not have to compute this
00059         // value, as it is useful in early termination
00060         unsigned int bpreq2;
00061 
00062         // The fraction of bitpatterns that must succeed
00063         float support;
00064 
00065         // The buffer of combinations.  Prevents using too much memory.
00066         vector<ItemSet*> buffer;
00067 
00068         // The buffer size
00069         unsigned int buffer_size;
00070 
00071         // The previously mined item sets
00072         ItemSetMap<int>* prevSets;
00073 
00074         // Helper methods
00075         void analyzeHelper();
00076         virtual bool analyzeLevel(unsigned int level);
00077         virtual void analyzeFirstLevel();
00078         virtual void analyzeNewLevel(unsigned int level);
00079         virtual void countTable(ItemSetMap<int>* result, unsigned int level,
00080             unsigned int length);
00081         virtual bool hasMatches(unsigned int i, unsigned int j,
00082             unsigned int level);
00083         virtual void pruneItemSets(ItemSetMap<int>* result,
00084             const vector<vector<unsigned int> >& tallies, unsigned int level);
00085         virtual unsigned int handlePrinting(unsigned int level);
00086 
00087     public:
00088         SPMiner(float balance = 0.5, float support = 1.0,
00089             unsigned int buffer_size = 1000);
00090         SPMiner(const SPMiner& src);
00091         virtual ~SPMiner();
00092         virtual SPMiner& operator =(const SPMiner& rhs);
00093 };
00094 
00095 #endif
 All Classes Functions Variables Typedefs Friends