关联规则挖掘算法学习报告(3)

2019-03-16 20:16

模式识别

this->Ouput(outfile);

//循环生成高项频繁集 while(1) {

this->GenerateAlternative(); this->CountSupport();

this->Generate_ItemSets();

if(this->vec_mutiItem.size()==0) return;

this->Ouput(outfile); } }

//输出一项频繁集到文件中

void Apriori::Ouput1(ostream &outfile) {

for(vector::const_iterator

iter=this->vec_item.begin();iter!=this->vec_item.end();++iter) {

outfile<key<<\<value<

outfile<

//输出高项频繁集到文件中

void Apriori::Ouput(ostream &outfile) {

for(vector::const_iterator

iter=this->vec_mutiItem.begin();iter!=this->vec_mutiItem.end();++iter) {

vector::const_iterator iter2=iter->key.begin(); for(;iter2!=iter->key.end()-1;++iter2) outfile<<*iter2<<\;

outfile<<*iter2<<\<value<

outfile<

#pragma once

#include #include using namespace std;

9

模式识别

struct Item {

string key; int value; };

struct MutiItem {

vector key; int value; };

#include \

MutiItem mutiTemp;

bool unaryPred(MutiItem &item) {

vector vec1=mutiTemp.key; vector vec2=item.key; int count=0;

for(vector::const_iterator

iter=vec2.begin();iter!=vec2.end();++iter) {

if(find(vec1.begin(),vec1.end(),*iter)

return count==vec1.size(); }

#include \

void main() {

Apriori ob;

ifstream infile; //读取数据集

ob.ReadFile(infile,\); ofstream outfile;

outfile.open(\);

//生成所有项频繁集

ob.Generate_AllItemSets(outfile);

10

模式识别

outfile.close();

cout<<\<

11


关联规则挖掘算法学习报告(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:回向魔祟部多火施仪轨(烟供仪轨,五明佛学院索达吉堪布传承)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: