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

📄 mssricc.cc

📁 一种聚类算法,名字是cocluster
💻 CC
📖 第 1 页 / 共 5 页
字号:
          colQuality4Compressed[cc] += (tempValue * tempValue) / (rowCS[rc] * colCS[cc] * colCS[cc]);      }}void MssrIcc::computeColQuality4Compressed1WayNormalized(){  double tempValue = 0;  for (int cc = 0; cc < numColCluster; cc++)    colQuality4Compressed[cc] = 0;  for (int cc = 0; cc < numColCluster; cc++)    if (colCS[cc] > 0)      for (int rc = 0; rc < numRowCluster; rc++){        tempValue = Acompressed[rc][cc];        if (tempValue != 0 && rowCS[rc] > 0)          colQuality4Compressed[cc] += (tempValue * tempValue) * rowCS[rc];      }}double MssrIcc::computeColQuality4Compressed2WayUnnormalized(int cc){  double tempValue = 0, temp = 0;  if (colCS[cc] > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = Acompressed[rc][cc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) / (rowCS[rc] * colCS[cc]);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed2WayNormalized(int cc){  double tempValue = 0, temp = 0;  if (colCS[cc] > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = Acompressed[rc][cc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) * (rowCS[rc] * colCS[cc]);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed1WayUnnormalized(int cc){  double tempValue = 0, temp = 0;  if (colCS[cc] > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = Acompressed[rc][cc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) / (rowCS[rc] * colCS[cc] * colCS[cc]);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed1WayNormalized(int cc){  double tempValue = 0, temp = 0;  if (colCS[cc] > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = Acompressed[rc][cc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) * rowCS[rc];    }  }  return temp;}double MssrIcc::computeColQuality4Compressed2WayUnnormalized(double *col2Way, int colClusterSize){  double tempValue = 0, temp = 0;  if (colClusterSize > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = col2Way[rc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) / (rowCS[rc] * colClusterSize);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed2WayNormalized(double *col2Way, int colClusterSize){  double tempValue = 0, temp = 0;  if (colClusterSize > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = col2Way[rc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) * (rowCS[rc] * colClusterSize);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed1WayUnnormalized(double *col1Way, int colClusterSize){  double tempValue = 0, temp = 0;  if (colClusterSize > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = col1Way[rc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) / (rowCS[rc] * colClusterSize * colClusterSize);    }  }  return temp;}double MssrIcc::computeColQuality4Compressed1WayNormalized(double *col1Way, int colClusterSize){  double tempValue = 0, temp = 0;  if (colClusterSize > 0){    for (int rc = 0; rc < numRowCluster; rc++){      tempValue = col1Way[rc];      if (tempValue != 0 && rowCS[rc] > 0)        temp += (tempValue * tempValue) * rowCS[rc];    }  }  return temp;}double MssrIcc::computeQuality4CompressedUnnormalized(){  double tempValue = 0, temp = 0;  for (int rc = 0; rc < numRowCluster; rc++)    if (rowCS[rc] > 0)      for (int cc = 0; cc < numColCluster; cc++){        tempValue = Acompressed[rc][cc];        if (tempValue != 0 && colCS[cc] > 0)          temp += (tempValue * tempValue) / (rowCS[rc] * colCS[cc]);      }  return temp;}double MssrIcc::computeQuality4CompressedNormalized(){  double tempValue = 0, temp = 0;  for (int rc = 0; rc < numRowCluster; rc++)    if (rowCS[rc] > 0)      for (int cc = 0; cc < numColCluster; cc++){        tempValue = Acompressed[rc][cc];        if (tempValue != 0 && colCS[cc] > 0)          temp += (tempValue * tempValue) * (rowCS[rc] * colCS[cc]);      }  return temp;}void MssrIcc::doRowFarthestInitialization(){  }void MssrIcc::doColFarthestInitialization(){}void MssrIcc::doRowRandomPerturbInitialization(){}void MssrIcc::doColRandomPerturbInitialization(){}double MssrIcc::rowDistance(int r, int rc){//  assert(isNormalizedCompressed);  return myCRS->computeRowDistance(r, rc, colCL, Acompressed, rowQuality4Compressed[rc]);}double MssrIcc::rowDistance(int r, int rc, bool *isReversed){//  assert(isNormalizedCompressed);  return myCRS->computeRowDistance(r, rc, colCL, Acompressed, rowQuality4Compressed[rc], isReversed);}double MssrIcc::colDistance(int c, int cc){//  assert(isNormalizedCompressed);  return myCCS->computeColDistance(c, cc, rowCL, Acompressed, colQuality4Compressed[cc]);}double MssrIcc::colDistance(int c, int cc, bool *isReversed){//  assert(isNormalizedCompressed);  return myCCS->computeColDistance(c, cc, rowCL, Acompressed, colQuality4Compressed[cc], isReversed);}void MssrIcc::reassignRC(){  int rowClusterChange = 0;  int tempRowCL, minCL;  double tempDistance, minDistance;  for (int r = 0; r < numRow; r++){    tempRowCL = rowCL[r];    minCL = tempRowCL;    minDistance = MY_DBL_MAX;    for (int rc = 0; rc < numRowCluster; rc++){      if (rowCS[rc] > 0){        tempDistance = rowDistance(r, rc);         updateVariable(minDistance, minCL, tempDistance, rc);      }    }    if (minCL != tempRowCL)      rowClusterChange++;    rowCL[r] = minCL;  }  checkDumpLevel4NumOfChange("row(s)", rowClusterChange);}void MssrIcc::reassignRC(bool *isReversed){  bool tempIsReversed = false;  int rowClusterChange = 0;  int tempRowCL, minCL;  double tempDistance, minDistance;  for (int r = 0; r < numRow; r++){    tempRowCL = rowCL[r];    minCL = tempRowCL;        if (isReversed[r]){      tempIsReversed = true;      minDistance = MY_DBL_MAX;      for (int rc = 0; rc < numRowCluster; rc++){        if (rowCS[rc] > 0){          tempDistance = rowDistance(r, rc, isReversed); 	  updateVariable(minDistance, minCL, tempDistance, rc);        }      }      isReversed[r] = false;       for (int rc = 0; rc < numRowCluster; rc++){        if (rowCS[rc] > 0){          tempDistance = rowDistance(r, rc); 	  updateVariable(minDistance, minCL, tempIsReversed, tempDistance, rc, false);        }      }     } else {					// (i.e., isReversed[r] == false)      tempIsReversed = false;      minDistance = MY_DBL_MAX;      for (int rc = 0; rc < numRowCluster; rc++)        if (rowCS[rc] > 0){          tempDistance = rowDistance(r, rc); 	  updateVariable(minDistance, minCL, tempDistance, rc);        }       isReversed[r] = true;      for (int rc = 0; rc < numRowCluster; rc++){       if (rowCS[rc] > 0){          tempDistance = rowDistance(r, rc, isReversed); 	  updateVariable(minDistance, minCL, tempIsReversed, tempDistance, rc, true);        }      }              }    if (minCL != tempRowCL)      rowClusterChange++;    rowCL[r] = minCL;    isReversed[r] = tempIsReversed;  }  checkDumpLevel4NumOfChange("row(s)", rowClusterChange);  checkDumpLevel4ReversedRow();}void MssrIcc::reassignCC(){  int colClusterChange = 0;  int tempColCL, minCL;  double minDistance, tempDistance;  for (int c = 0; c < numCol; c++){    tempColCL = colCL[c];    minCL = tempColCL;    minDistance = MY_DBL_MAX;    for (int cc = 0; cc < numColCluster; cc++){      if (colCS[cc] > 0){        tempDistance = colDistance(c, cc); 	updateVariable(minDistance, minCL, tempDistance, cc);      }      }    if (minCL != tempColCL)      colClusterChange++;    colCL[c] = minCL;  }  checkDumpLevel4NumOfChange("col(s)", colClusterChange);}void MssrIcc::reassignCC(bool *isReversed){  int colClusterChange = 0;  int tempColCL, minCL;  double tempDistance, minDistance;  for (int c = 0; c < numCol; c++){    tempColCL = colCL[c];    minCL = tempColCL;    minDistance = MY_DBL_MAX;    for (int cc = 0; cc < numColCluster; cc++){      if (colCS[cc] > 0){        tempDistance = colDistance(c, cc, isReversed); 	updateVariable(minDistance, minCL, tempDistance, cc);      }      }    if (minCL != tempColCL)      colClusterChange++;    colCL[c] = minCL;  }  checkDumpLevel4NumOfChange("col(s)", colClusterChange);}void MssrIcc::doBatchUpdate(){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeAcompressed();  isNormalizedCompressed = false;  normalizeCompressedMatrix();  do {    numIteration++;    myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);    oldObjValue = objValue;        if (numRowCluster < numRow){      computeRowQuality4Compressed1WayNormalized();      reassignRC();      computeRowClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("row", numIteration);    }        if (numColCluster < numCol){      computeColQuality4Compressed1WayNormalized();      reassignCC();      computeColClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeObjectiveFunction4Normalized();          checkDumpLevel4BatchUpdate("col", numIteration);    }    rowSmoothingFactor *= myCRS->getAnnealingFactor();    colSmoothingFactor *= myCCS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  checkDumpLevel4BatchUpdate("end");}void MssrIcc::doBatchUpdate(bool *isReversed){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeAcompressed(isReversed);  isNormalizedCompressed = false;  normalizeCompressedMatrix();  do {    numIteration++;        myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);    oldObjValue = objValue;        if (numRowCluster < numRow){      computeRowQuality4Compressed1WayNormalized();      reassignRC(isReversed);      computeRowClusterSize();      computeAcompressed(isReversed);

⌨️ 快捷键说明

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