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

📄 summary.c~

📁 Solaris环境下的数据挖掘算法:birch聚类算法。该算法适用于对大量数据的挖掘。
💻 C~
字号:
#include <iostream.h>#include <fstream.h>#include <math.h>#include "vector.h"#define NUMCLUSTERS 100#define NUMATTRS    2void Summary(char *labelfile, char *inputfile) {   ifstream ifile;  ifstream labFile;  ofstream ofile;  Vector summary[NUMCLUSTERS];  Vector temp;  temp.Init(NUMATTRS);   int		 z=-1;  int		 number=0;  int		 numvecs[NUMCLUSTERS];  double	 metric = 0.0;    ifile.open(inputfile);  labFile.open(labelfile);    for (int i=0; i < NUMCLUSTERS; i++){    summary[i].Init(NUMATTRS);  }  while(labFile.peek() != EOF) {    for (int i=0; i < NUMATTRS; i++){      ifile >> temp.value[i];    }    labFile >> z;    summary[z] += temp;    numvecs[z]++;    number++;  }  cout << " NUMBER :" << number << endl;  for (int i=0; i < NUMCLUSTERS; i++){    summary[z] /= numvecs[z];    ofile << numvecs[z] << "   ";    ofile << summary[z] << endl;  }  ifile.close();  labFile.close();  ifile.open(inputfile);  labFile.open(labelfile);    while (ifile.peek() != EOF){    for (int i=0; i < NUMATTRS; i++){      ifile >> temp.value[i];    }    labFile >> z;    metric += sqrt( summary[z] || temp);  }  ofile << " The cluster metric is " << metric << endl;}main(int argc, char* argv) {  if (argc < 3)    {      cout << " Usage: summary <label filename> <data filename>" << endl;      exit(1);    }  Summary(&argv[1], &argv[2]);}

⌨️ 快捷键说明

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