⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 parameters.cpp

📁 关联规则挖掘数据产生程序.VISUAL C++ 可产生满足要求的挖掘数据.
💻 CPP
字号:
// UniformDist.cpp: implementation of the UniformDist class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "Parameters.h"

#include <math.h>
#include <stdio.h>
#include <assert.h>

//------------------------------- Parameters -------------------------------


void PatternPar::write(ostream &fp)
{
  fp << "\tNumber of patterns = " << npats << endl;
  fp << "\tAverage length of pattern = " << patlen << endl;
  fp << "\tCorrelation between consecutive patterns = " << corr << endl;
  fp << "\tAverage confidence in a rule = " << conf << endl;
  fp << "\tVariation in the confidence = " << conf_var << endl;
}


void TransPar::write(ostream &fp)
{
  fp << "Number of transactions in database = " << ntrans << endl;
  fp << "Average transaction length = " << tlen << endl;
  fp << "Number of items = " << nitems << endl;

  fp << "Large Itemsets:" << endl;
  lits.write(fp);
  fp << endl;
}


// calculate the number of roots, given the number of levels
void TaxPar::calc_values(void)
{
  int nset;
  
  nset = 0;
  nset += (nlevels != 0);
  nset += (fanout != 0);
  nset += (nroots != 0);
  
  switch (nset) 
    {
    case 0:	// fill in defaults
      nroots = 250;
      fanout = 5;
      return;

    case 1:	// need to fill in 1 value
      assert (nlevels == 0);
      if (fanout == 0)
	fanout = 5;
      else if (nroots == 0)
	nroots = 250;
      return;

    case 2:
      if (nlevels == 0)		// all set!
	return;
      if (fanout != 0) {	// calculate nroots
	nroots = nitems / (1 + pow(double(fanout), double(nlevels-1)));
	if (nroots < 1)
	  nroots = 1;
      }
      else if (nroots != 0) {	// calculate fanout
	float temp;
	temp = (float)nitems / nroots - 1;
	temp = log((double)temp) / (nlevels - 1);
	fanout = exp((double)temp);
      }
    case 3:			// all set!
      return;
    }
}


void TaxPar::write(ostream &fp)
{
  fp << "Number of transactions in database = " << ntrans << endl;
  fp << "Average transaction length = " << tlen << endl;
  fp << "Number of items = " << nitems << endl;
  fp << "Number of roots = " << nroots << endl;
  fp << "Number of levels = " << nlevels << endl;
  fp << "Average fanout = " << fanout << endl;

  fp << "Large Itemsets:" << endl;
  lits.write(fp);
  fp << endl;
}


void SeqPar::write(ostream &fp)
{
  fp << "Number of customers in database = " << ncust << endl;
  fp << "Average sequence length = " << slen << endl;
  fp << "Average transaction length = " << tlen << endl;
  fp << "Number of items = " << nitems << endl;
  fp << "Repetition-level = " << rept << endl;
  fp << "Variation in repetition-level = " << rept_var << endl;

  fp << "Large Itemsets:" << endl;
  lits.write(fp);
  fp << "Large Sequences:" << endl;
  lseq.write(fp);
  fp << endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -