Processamento de Dados Massivos/Projeto e implementação de aplicações Big Data/Mineração de Itemsets Frequentes: diferenças entre revisões

Saltar para a navegação Saltar para a pesquisa
{
vector< pair<string,string> > mapped;
// ... some parts are omited
float minsup = MINSUP;
unsigned maxsize = MAXSIZE;
string filename = a.first;
irlib::Dictionary vocabulary; // Vocabulary: term -> termid
TransactionReader transactionReader(vocabulary); // Reading file
vector<Transaction> transactions = transactionReader.read(filename); // Building transaction set
ItemsetMiner * miner = new Eclat(vocabulary, supminsupport, maxsizemaxrulesize); // Calling Eclat
unsigned sup(minsup * transactions.size());
ItemsetMiner * miner = new Eclat(vocabulary, sup, maxsize); // Calling Eclat
InvList * invlist = miner->mine(transactions);
for (pair< set<unsigned>,set<unsigned> > mfi : (*invlist) )
{
stringstream str; str << mfi.second.size() << ' ';
str << mfi.second.size() << ' ';
vector<unsigned> termids(mfi.first.begin(),mfi.first.end());
for (unsigned termid : termids) str << vocabulary.terms[termid] << ' ';
virtual pair<string,string> reduce( pair<string, vector<string> > bs )
{
stringstringstream reduced;
for (unsigned i = 0 ; i < bs.second.size() ; ++i) strreduced << bs.second[i] << '\n';
stringstream str;
return pair<string,string>(bs.first,reduced.str());
for (unsigned i = 0 ; i < bs.second.size() ; ++i) str << bs.second[i] << '\n';
reduced = str.str();
return pair<string,string>(bs.first,reduced);
};
};
for (pair<string,unsigned> itemset : subset_counting)
{
stringstream str; str << itemset.second << ' ';
str << itemset.second << ' ';
mapped.push_back(make_pair(itemset.first,str.str()));
}
virtual pair<string,string> reduce( pair<string, vector<string> > bs )
{
string reduced;
unsigned sum(0);
for (unsigned i = 0 ; i < bs.second.size() ; ++i) sum += atoi(bs.second[i].c_str());
stringstream strreduced; strreduced << sum;
return pair<string,string>(bs.first,reduced.str());
reduced = str.str();
return pair<string,string>(bs.first,reduced);
};
};
152

edições

Menu de navegação