ItemSet GLCM::calF(BinaryMatrix * BM, vector< vector< pair<int,int> > > G1Item, const vector<BinaryMatrix *> & vBM, string freType, int & resFre) { ItemSet is = ItemSet(); is.clear(); int BMSize = BM->getSize(); BinaryMatrix * calFBM = new BinaryMatrix(BMSize); calFBM->setContrastTo0(BM); if (freType == "gra") resFre = calFBM->getActive(); else { vector<int> freMap; freMap.clear(); for (int i = 0; i < BMSize; i++) { freMap.push_back(-1); } loop_Chk_Freq(calFBM,freMap); resFre = frequentCount(freMap); } delete calFBM; if (resFre < _threshold) return is; int G1ItemSize = G1Item.size(); for (int i = 0; i < G1ItemSize; i++) { BinaryMatrix tBM = (*vBM[i]); tBM &= (*BM); if (tBM == (*BM)) is.addItem(i); } return is; }
void CLxItemSelection::GetSet ( ItemSet &set) { CLxUser_Item item; LXtScanInfoID scan; void *pkt; set.clear (); scan = 0; while (scan = srv_sel.ScanLoop (scan, sel_ID, &pkt)) { pkt_trans.GetItem (pkt, item); if (Include (item)) set.insert (item); } }
void GLCM::GLCMAlgo( DBMain * DB, float threshold, string freType,string so, std::ostream &output) { TimeTracker tt1; tt1.Start(); nbIS = 0; ItemSet P = ItemSet(); P.clear(); ClosedItemSetList.clear(); BinaryMatrixList.clear(); vector< vector< pair<int,int> > > G1Item = buildG_1item(DB); cout << "There are " << G1Item[0].size() << " customers, and " << G1Item.size()/2 << " attributes." << endl << endl; if ((freType == "nor") || (freType == "norwTSs")) { _threshold = (int) ceil(threshold * G1Item[0].size()); } else if (freType == "gra") { _threshold = (int) ceil(((threshold * G1Item[0].size() * (G1Item[0].size() - 1)))/2); } vector<BinaryMatrix *> vBM = constructBinaryMatrixAll(G1Item); BinaryMatrix BM = BinaryMatrix(); cout << "Begin GLCM" << endl; int G1ItemSized2 = G1Item.size()/2; for (int i = 0; i < G1ItemSized2; i++) { cout << "Item Sets start with: " << i + 1 << "+" << endl; ItemSet P1 = P.addItemwCore_i(i*2); BM = (*vBM[i*2]); int resFre = 0; int BMSize = BM.getSize(); BinaryMatrix * calFBM = new BinaryMatrix(BMSize); calFBM->setContrastTo0(BM); if (freType == "gra") resFre = calFBM->getActive(); else { vector<int> freMap; freMap.clear(); for (int i = 0; i < BMSize; i++) { freMap.push_back(-1); } loop_Chk_Freq(calFBM,freMap); resFre = frequentCount(freMap); } delete calFBM; bool printTSsFlag = false; if (freType == "norwTSs") printTSsFlag = true; GLCMloop(P1, BM, G1Item, vBM, freType, so, output, resFre, printTSsFlag); } double ts1 = tt1.Stop(); cout << endl << "Execution took " << setw(5) << ts1 << " sec" << endl; vector<BinaryMatrix*>::const_iterator posVBM ; for (posVBM = vBM.begin() ; posVBM != vBM.end() ; ++posVBM) delete *posVBM ; vBM.clear() ; ostringstream ost1; ost1 << getpid (); string cmd1="ps -p "+ost1.str ()+" -o rss"; cout << "Execution Memory usage : " << endl; //system(cmd1.c_str()); cout << endl; }