?? parameters.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 + -