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 00032 #ifndef MAFIAMINER_H 00033 #define MAFIAMINER_H 00034 00035 // ---------------------------- Internal Headers ---------------------------- // 00036 00037 #include "ItemSetMap.h" 00038 #include "Miner.h" 00039 00046 class MafiaMiner: public Miner 00047 { 00048 protected: 00049 // The fraction of the rows that must comprise each bitpattern 00050 float balance; 00051 00052 // The required number of occurances for each bitpattern 00053 unsigned int bpreq; 00054 00055 // This is twice the required number of occurances for each bitpattern 00056 // it may seems redundant, but it is nice to not have to compute this 00057 // value, as it is useful in early termination 00058 unsigned int bpreq2; 00059 00060 // The fraction of bitpatterns that must succeed 00061 float support; 00062 00063 // The previously mined item sets 00064 ItemSetMap<bool> map; 00065 00066 // the size of the buffer 00067 unsigned int buffer_size; 00068 00069 // These three are used for updating the status 00070 double denominator; 00071 00072 virtual void analyzeHelper(); 00073 virtual void createDerivatives(const ItemSet* is, 00074 vector<ItemSet*>& sets); 00075 virtual void analyzeItemSets(vector<ItemSet*>& sets, 00076 unsigned int level); 00077 virtual void analyzeItemSet(ItemSet* is, 00078 const vector<unsigned int>& tallies, unsigned int height, 00079 vector<ItemSet*>& dsets); 00080 virtual void genstatus(const ItemSet* is); 00081 00082 public: 00083 MafiaMiner(float balance = 0.5, float support = 1.0, 00084 unsigned int buffer_size = 1000); 00085 MafiaMiner(const MafiaMiner& src); 00086 virtual ~MafiaMiner(); 00087 virtual MafiaMiner& operator =(const MafiaMiner& rhs); 00088 }; 00089 00090 #endif