亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? externalvalidity.cc

?? 一種聚類算法,名字是cocluster
?? CC
字號:
/*  ExternalVality.cc    Implementation of the ExternalValidity class    Copyright (c) 2005, 2006              by Hyuk Cho    Copyright (c) 2003, 2004    	      by Hyuk Cho, Yuqiang Guan, and Suvrit Sra                {hyukcho, yguan, suvrit}@cs.utexas.edu*/#include <iostream>#include <fstream>#include <algorithm>#include <vector>#include <cmath>#include <stdio.h>#include <assert.h>#include "ExternalValidity.h"using namespace std;ExternalValidity::ExternalValidity(int nClass, int nCluster, int nPoint, int *classLbl, int *clusterLbl){  numClass = nClass;  numCluster = nCluster;  numPoint = nPoint;  classLabel = classLbl;  clusterLabel = clusterLbl;  clusterSize = new int [numCluster];  classSize = new int [numClass];  confusionMatrix = new int * [numCluster];  for (int i = 0; i < numCluster; i++)    confusionMatrix[i] = new int [numClass];  for (int i = 0; i < numCluster; i++)    clusterSize[i] = 0;  for (int i = 0; i < numClass; i++)    classSize[i] = 0;  for (int i = 0; i < numPoint; i++){    clusterSize[clusterLabel[i]]++;    classSize[classLabel[i]]++;  }  for(int i = 0; i < numCluster; i++)    for (int j = 0; j < numClass; j++)      confusionMatrix[i][j] = 0;  for (int i = 0; i < numPoint; i++)    confusionMatrix[clusterLabel[i]][classLabel[i]]++;  isSilent = false;		// not used...  memoryUsed += (numCluster*numClass + numCluster + numClass) * sizeof(int);}ExternalValidity::~ExternalValidity(){  for (int j=0; j< numClass; j++)    delete [] confusionMatrix[j];  delete [] confusionMatrix;  delete [] classSize;  delete [] clusterSize;}void ExternalValidity::setSilent(bool s)	// not used...{  isSilent = s;}void ExternalValidity::printCM(ostream &os){  if ((!os) == 0){    os << "  Confusion Matrix" << endl;    for (int i = 0; i < numCluster; i++){//      os << endl << "\t";      for (int j = 0; j < numClass; j++)        os << "\t" << confusionMatrix[i][j];      os << endl;    }    os << endl;  }}void ExternalValidity::purity_Entropy_MutInfo(bool isShowingEachCluster, ostream &os1, ostream &os2, ostream &os3){  int *sum_row, *sum_col;  double sum, max, mut_info = 0.0, average_purity = 0.0, average_entropy = 0.0;  sum_row = new int [numCluster];  sum_col = new int [numClass];  for(int i = 0;i < numCluster; i++){    sum = 0.0;    max = -1;    for(int j = 0; j < numClass; j++){      if (max < confusionMatrix[i][j])        max = confusionMatrix[i][j];      if (clusterSize[i] != 0 && confusionMatrix[i][j] != 0)        sum += (double)confusionMatrix[i][j] / clusterSize[i] * log((double)clusterSize[i] / confusionMatrix[i][j]) / log((double)numClass);    }    if(clusterSize[i] != 0){        if (isShowingEachCluster){        if ((!os1) == 0){          os1 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;          os1 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;        }        if ((!os2) == 0){          os2 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;          os2 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;        }        if ((!os3) == 0){          os3 << "  Purity of cluster  " << i << "        = " << (double)max/clusterSize[i] << endl;          os3 << "  Entropy of cluster " << i << "        = " << sum*log(2.0) << endl;        }      }      average_purity += (double)max / clusterSize[i];    }     average_entropy += sum;  }  if ((!os1) == 0){    os1 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;    os1 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;  }  if ((!os2) == 0){    os2 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;    os2 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;  }  if ((!os3) == 0){    os3 << "  Average Purity of clusters  = " << average_purity / numCluster << endl;    os3 << "  Average Entropy of clusters = " << average_entropy * log(2.0) / numCluster << endl;  }  for(int i = 0; i < numCluster; i++){    sum_row[i] = 0;    for(int k = 0; k < numClass; k++)      sum_row[i] += confusionMatrix[i][k];  }  for(int k = 0; k < numClass; k++){    sum_col[k] = 0;    for(int i = 0; i < numCluster; i++)      sum_col[k] += confusionMatrix[i][k];  }  for(int i = 0; i < numCluster; i++)    for(int k = 0; k < numClass; k++)      if (confusionMatrix[i][k] > 0)        mut_info += confusionMatrix[i][k] * log(confusionMatrix[i][k] * numPoint * 1.0 / (sum_row[i] * sum_col[k]));  mut_info /= numPoint;  double hx = 0, hy = 0, min;  for (int i = 0; i < numCluster; i++)    if (sum_row[i] > 0)      hx += sum_row[i] * log(sum_row[i] * 1.0);      hx = log(numPoint * 1.0) - hx / numPoint;  for (int i = 0; i < numClass; i++)    if (sum_col[i] > 0)      hy += sum_col[i] * log(sum_col[i] * 1.0);  hy = log(numPoint * 1.0) - hy / numPoint;  //min = hx<hy?hx:hy;  min = (hx + hy) / 2;  if ((!os1) == 0)    os1 << "  (Normalized) MI of clusters = " << mut_info / min << endl;  if ((!os2) == 0)    os2 << "  (Normalized) MI of clusters = " << mut_info / min << endl;  if ((!os3) == 0)    os3 << "  (Normalized) MI of clusters = " << mut_info / min << endl;  delete [] sum_row;  delete [] sum_col;}void ExternalValidity::F_measure(ostream &os1, ostream &os2, ostream &os3){  double **Recall, **Precision, **F;  double F_value;   Recall = new double *[numCluster];  for (int i = 0; i < numCluster; i++)    Recall[i] = new double[numClass];  Precision = new double *[numCluster];  for (int i = 0; i < numCluster; i++)    Precision[i] = new double[numClass];  F = new (double *)[numCluster];  for (int i = 0; i < numCluster; i++)    F[i] = new double[numClass];  for (int i = 0; i < numCluster; i++)    for (int j = 0; j < numClass; j++)      Recall[i][j] = confusionMatrix[i][j] * 1.0 / classSize[j];  for (int i = 0; i < numCluster; i++)    for (int j = 0; j < numClass; j++)      Precision[i][j] = confusionMatrix[i][j] * 1.0 / clusterSize[i];  for (int i = 0; i < numCluster; i++)    for (int j = 0; j < numClass; j++)      F[i][j] = 2.0 * Recall[i][j] * Precision[i][j] / (Recall[i][j] + Precision[i][j]);  F_value = 0.0;  for (int j = 0; j < numClass; j++){    double temp_max = 0.0;    for (int i = 0; i < numCluster; i++)      if (temp_max < F[i][j])	temp_max = F[i][j];    F_value += temp_max * classSize[j];  }  F_value /= numPoint;  if ((!os1) == 0)    os1 << "  F-measure value of clusters = " << F_value << endl;  if ((!os2) == 0)    os2 << "  F-measure value of clusters = " << F_value << endl;  if ((!os3) == 0)    os3 << "  F-measure value of clusters = " << F_value << endl;  for(int i = 0; i < numCluster; i++){    delete [] Recall[i];    delete [] Precision[i];    delete [] F[i];  }  delete [] F;  delete [] Precision;  delete [] Recall;}void ExternalValidity::micro_avg_precision_recall(double &p_t, double &r_t, ostream &os1, ostream &os2, ostream &os3)  /* for the definition of micro-average precision/recall see paper "Unsupervised document classification     using sequential information maximization" by N. Slonim, N. Friedman and N. Tishby */{  int *uni_label, *alpha, *beta, *gamma;  uni_label = new int[numCluster];  for (int i = 0; i < numCluster; i++){    uni_label[i] = 0;    double temp = confusionMatrix[i][0];    for (int j = 1; j < numClass; j++)      if (temp < confusionMatrix[i][j]){        temp = confusionMatrix[i][j];	uni_label[i] = j;      }  }  alpha = new int[numClass];  beta = new int[numClass];  gamma = new int[numClass];  for (int j = 0; j < numClass; j++){    alpha[j] = 0;    beta[j] = 0;    gamma[j] = 0;  }  for (int i = 0; i < numPoint; i++)    if (uni_label[clusterLabel[i]] == classLabel[i])      alpha[classLabel[i]]++;    else {      beta[uni_label[clusterLabel[i]]]++;      gamma[classLabel[i]]++;    }  double temp = 0, temp1 = 0;  for (int j = 0; j < numClass; j++){    temp += alpha[j];    temp1 += beta[j];  }  temp1 += temp;  p_t = temp * 1.0 / temp1;  temp1 = 0;  for (int j = 0; j < numClass; j++)    temp1 += gamma[j];  temp1 += temp;  r_t = temp * 1.0 / temp1;  if ((!os1) == 0){    os1 << "  Micro-average Precision     = " << p_t << endl;    os1 << "  Micro-average Recall        = " << r_t << endl << endl;  }  if ((!os2) == 0){    os2 << "  Micro-average Precision     = " << p_t << endl;    os2 << "  Micro-average Recall        = " << r_t << endl << endl;  }  if ((!os3) == 0){    os3 << "  Micro-average Precision     = " << p_t << endl;    os3 << "  Micro-average Recall        = " << r_t << endl << endl;  }  delete [] uni_label;  delete [] alpha;  delete [] beta;  delete [] gamma;}    void ExternalValidity::getAccuracy(double &accuracy, ostream &os1, ostream &os2, ostream &os3)  /* This computes the general precision, sometimes called accuracy, which can be defined as:     Accuracy = 1/T (sum_{i=1}^l (t_i)) * 100,      where T denotes the total number of points,            l denotes the number of clusters,	   and t_i denotes the number of the points correctly clustered into a corresponding class i.     Notice that each t_i is a diagonal element of the corresponding confusion matrix whose cluster labels      are permuted so that sum of diagonal elements is maximized.  */ {  assert(numClass == numCluster);  vector<int> v;  // create the data...  for (int i = 0; i < numClass; i++)    v.push_back(i);  // permutate the data...  int maxTrace = 0;  do {    int tempTrace = 0;    for (int i = 0; i < numClass; i++)      tempTrace += confusionMatrix[v[i]][i];    if (tempTrace > maxTrace)      maxTrace = tempTrace;  } while (next_permutation(v.begin(), v.end()));  int tempSum = 0;  for (int i = 0; i < numClass; i++)    for (int j = 0; j < numClass; j++)      tempSum += confusionMatrix[i][j];  accuracy = (double)maxTrace / (double)tempSum;  if ((!os1) == 0)    os1 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;  if ((!os2) == 0)    os2 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;  if ((!os3) == 0)    os3 << "  Accuracy (= Precision)      = " << accuracy << endl << endl;}    

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色视频成人在线观看免| 蜜桃精品视频在线观看| 99久久免费国产| 自拍偷在线精品自拍偷无码专区| 国产成+人+日韩+欧美+亚洲| 中文字幕一区二区三区色视频| 成人理论电影网| 亚洲福利一区二区| 欧美日产国产精品| 韩国av一区二区| 国产精品国产三级国产aⅴ原创| 97久久精品人人做人人爽| 亚洲综合精品久久| 91精品国产日韩91久久久久久| 国内精品视频一区二区三区八戒| 中文字幕第一区| 欧亚一区二区三区| 国产一区二区三区最好精华液| 国产精品乱人伦中文| 欧美吞精做爰啪啪高潮| 久久精品国产**网站演员| 国产欧美中文在线| 欧美日韩国产系列| 成人精品电影在线观看| 一区二区三区.www| 精品国产三级a在线观看| 成人18视频在线播放| 亚洲6080在线| 国产精品色在线观看| 欧美日韩国产影片| heyzo一本久久综合| 男女激情视频一区| 玉米视频成人免费看| 26uuu成人网一区二区三区| 91色.com| 国产成人在线网站| 午夜精品福利一区二区三区av| 中文一区一区三区高中清不卡| 欧美日韩精品欧美日韩精品一综合| 国产一区二区三区综合| 亚洲图片一区二区| 欧美国产日韩精品免费观看| 欧美二区在线观看| 91麻豆文化传媒在线观看| 国产在线不卡一区| 日本午夜精品视频在线观看| 自拍偷拍国产精品| 久久精品人人做| 日韩精品一区二区三区老鸭窝 | 91国产视频在线观看| 蓝色福利精品导航| 亚洲一区二区欧美激情| 国产精品成人一区二区艾草| 日韩欧美国产三级电影视频| 欧美无砖专区一中文字| 91香蕉视频污| www.成人在线| 成人av在线网站| 高清不卡在线观看| 国产综合色产在线精品| 免费观看一级特黄欧美大片| 亚洲综合免费观看高清完整版在线 | 亚洲一区在线视频观看| 亚洲欧洲美洲综合色网| 国产精品午夜免费| 欧美激情中文字幕| 国产偷v国产偷v亚洲高清| 欧美成人在线直播| 精品美女一区二区| 欧美一级艳片视频免费观看| 欧美福利电影网| 欧美日韩成人在线| 欧美美女bb生活片| 欧美日韩欧美一区二区| 欧美精品视频www在线观看| 欧美亚洲国产一区在线观看网站| 色综合婷婷久久| 在线观看免费视频综合| 欧美伊人久久大香线蕉综合69| 欧美体内she精高潮| 欧美日韩另类国产亚洲欧美一级| 欧美日韩在线精品一区二区三区激情| 日本乱人伦aⅴ精品| 欧美亚洲愉拍一区二区| 欧美日韩国产一二三| 欧美一级久久久久久久大片| 日韩免费高清av| 久久综合国产精品| 国产香蕉久久精品综合网| 国产精品免费av| 亚洲综合自拍偷拍| 日韩精品亚洲专区| 韩国在线一区二区| 91在线一区二区| 欧美老肥妇做.爰bbww| 日韩久久久精品| 国产精品久久久久久久久晋中 | 日韩精品一区二区三区蜜臀 | 欧美一区二区成人6969| 久久综合久久99| 国产精品福利影院| 亚洲午夜影视影院在线观看| 日韩电影免费一区| 国产成人av影院| 欧美亚洲一区三区| 亚洲精品在线免费播放| 中文字幕制服丝袜成人av | 91影视在线播放| 这里是久久伊人| 国产精品无人区| 亚洲电影在线免费观看| 狠狠v欧美v日韩v亚洲ⅴ| 91在线丨porny丨国产| 日韩一区二区三区在线视频| 国产精品私人影院| 免费精品99久久国产综合精品| 国产999精品久久久久久绿帽| 欧美自拍偷拍一区| 久久久久亚洲综合| 亚洲一二三专区| 国产黄色精品视频| 91麻豆精品国产91久久久使用方法 | 国产成人精品综合在线观看 | 日韩一级黄色大片| 亚洲人精品午夜| 精品一二线国产| 欧美在线观看一二区| 精品91自产拍在线观看一区| 亚洲免费在线观看| 国产一区二区福利视频| 欧美三级中文字| 亚洲三级小视频| 国产一区二区影院| 欧美一区二区视频在线观看| 亚洲女同ⅹxx女同tv| 国产乱人伦偷精品视频免下载 | 国产专区欧美精品| 欧美性色综合网| 国产精品无圣光一区二区| 久久国产精品露脸对白| 欧美午夜寂寞影院| 最新中文字幕一区二区三区 | aaa国产一区| 欧美激情一区二区| 国产一区二区在线影院| 日韩一区二区麻豆国产| 亚洲成av人综合在线观看| 99久久国产综合色|国产精品| 久久婷婷色综合| 日韩激情在线观看| 欧美日韩高清在线播放| 一区二区三区小说| 成人国产亚洲欧美成人综合网| 精品久久久网站| 久久精品理论片| 欧美日韩国产美女| 亚洲成a天堂v人片| 欧美日韩激情一区二区| 亚洲高清视频的网址| 一本色道久久综合亚洲精品按摩| 国产精品蜜臀在线观看| 菠萝蜜视频在线观看一区| 日本一区二区电影| 波多野结衣亚洲| 自拍偷拍亚洲综合| 在线欧美一区二区| 亚洲国产另类精品专区| 欧美三级日韩三级国产三级| 亚洲图片自拍偷拍| 欧美一区午夜视频在线观看| 日本欧美一区二区| 日韩色视频在线观看| 激情都市一区二区| 久久蜜桃一区二区| 成人av动漫在线| 一区二区三区电影在线播| 欧美在线视频全部完| 亚洲无人区一区| 日韩欧美www| 国产成人免费高清| 亚洲精品ww久久久久久p站| 色婷婷久久99综合精品jk白丝 | 欧美tk—视频vk| 国产毛片精品一区| 国产精品第四页| 欧美日韩免费在线视频| 免费成人在线影院| 国产精品乱人伦| 欧美日韩一区二区在线视频| 久久福利视频一区二区| 日本一区二区三区国色天香 | 成人一区二区三区在线观看| 亚洲同性gay激情无套| 欧美一a一片一级一片| 久久精品久久久精品美女| 国产精品久久久久天堂| 欧美日韩精品三区| 国产91在线看| 亚洲3atv精品一区二区三区| www成人在线观看|