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

📄 mssriicc.cc

📁 一种聚类算法,名字是cocluster
💻 CC
📖 第 1 页 / 共 5 页
字号:
}/*// It doesn't guarantee the monotonic decrease of objective function values.void MssrIIcc::doBatchUpdate4VariationIII(){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0, numRowIteration = 0, numColIteration = 0;  int *beforeRowCL = new int[numRow];  int *afterRowCL = new int[numRow];  double oldObjValue;  double tempRowSmoothingFactor = rowSmoothingFactor, tempColSmoothingFactor = colSmoothingFactor;  computeRowClusterSize();  computeColClusterSize();  computeAcompressed();  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid();  normalizeRowCentroid();  computeColCentroid();  normalizeColCentroid();  do {    numIteration++;    for (int r = 0; r < numRow; r++)      beforeRowCL[r] = rowCL[r];    myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, tempColSmoothingFactor);    do {      numRowIteration++;      myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);      oldObjValue = objValue;//-----------      reassignRC();      computeRowClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeRowCentroid();      normalizeRowCentroid();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("row", numRowIteration);      tempRowSmoothingFactor *= myCRS->getAnnealingFactor();    } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));//------------    for (int r = 0; r < numRow; r++){      afterRowCL[r] = rowCL[r];      rowCL[r] = beforeRowCL[r];    }    computeRowClusterSize();    computeAcompressed();    isNormalizedCompressed = false;    normalizeCompressedMatrix();    for (int r = 0; r < numRow; r++)      rowCL[r] = afterRowCL[r];    computeRowClusterSize();    tempRowSmoothingFactor = rowSmoothingFactor;    myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);//-----------    do {      numColIteration++;      myCCS->setSmoothingFactor(smoothingType, tempColSmoothingFactor);      oldObjValue = objValue;//      reassignCC4Variation();			// Both are ok because Acompressed is based on old rowCL.      reassignCC();      computeColClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeColCentroid();      normalizeColCentroid();      computeObjectiveFunction4Normalized(Acompressed);      checkDumpLevel4BatchUpdate("col", numColIteration);      tempColSmoothingFactor *= myCCS->getAnnealingFactor();    } while ((oldObjValue - objValue) > (colBatchUpdateThreshold * squaredFNormA));//-----------    oldObjValue = objValue;    computeRowClusterSize();    computeAcompressed();    isNormalizedCompressed = false;    normalizeCompressedMatrix();    oldObjValue = objValue;    computeObjectiveFunction4Normalized();    checkDumpLevel4BatchUpdate("both", numIteration);//-----------  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  colSmoothingFactor = tempColSmoothingFactor;  delete [] beforeRowCL;  delete [] afterRowCL;  checkDumpLevel4BatchUpdate("end");}*/void MssrIIcc::doBatchUpdate4VariationIII(){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeRowClusterSize();  computeColClusterSize();  computeAcompressed();  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid();  normalizeRowCentroid();  computeColCentroid();  normalizeColCentroid();  do {    numIteration++;    myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);    oldObjValue = objValue;        if (randNumGenerator.GetUniform() > SELECTION_PROBABILITY){      reassignRC();      computeRowClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeRowCentroid();      normalizeRowCentroid();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("row", numIteration);    } else {      reassignCC();      computeColClusterSize();      computeAcompressed();      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeColCentroid();      normalizeColCentroid();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("col", numIteration);    }    rowSmoothingFactor *= myCRS->getAnnealingFactor();    colSmoothingFactor *= myCCS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  checkDumpLevel4BatchUpdate("end");}void MssrIIcc::doBatchUpdate4VariationIV(){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeRowClusterSize();  computeColClusterSize();  computeAcompressed();  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid();  normalizeRowCentroid();  computeColCentroid();  normalizeColCentroid();  myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);  myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);  do {    numIteration++;    if (randNumGenerator.GetUniform() > SELECTION_PROBABILITY){      myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);      do {        oldObjValue = objValue;        reassignRC();        computeRowClusterSize();        computeAcompressed();        isNormalizedCompressed = false;        normalizeCompressedMatrix();        computeRowCentroid();        normalizeRowCentroid();        computeObjectiveFunction4Normalized();        checkDumpLevel4BatchUpdate("row", numIteration);      } while ((oldObjValue - objValue) > (MULTIPLE_FACTOR * rowBatchUpdateThreshold * squaredFNormA));      rowSmoothingFactor *= myCRS->getAnnealingFactor();    } else {      myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);      do {        oldObjValue = objValue;        reassignCC();        computeColClusterSize();        computeAcompressed();        isNormalizedCompressed = false;        normalizeCompressedMatrix();        computeColCentroid();        normalizeColCentroid();        computeObjectiveFunction4Normalized();        checkDumpLevel4BatchUpdate("col", numIteration);      } while ((oldObjValue - objValue) > (MULTIPLE_FACTOR * colBatchUpdateThreshold * squaredFNormA));      colSmoothingFactor *= myCCS->getAnnealingFactor();    }  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  checkDumpLevel4BatchUpdate("end");}void MssrIIcc::doBatchUpdate(bool *isReversed){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeRowClusterSize();  computeColClusterSize();  computeAcompressed(isReversed);  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid(isReversed);  normalizeRowCentroid();  computeColCentroid(isReversed);  normalizeColCentroid();  do {    numIteration++;    myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);    oldObjValue = objValue;    if (numRowCluster < numRow){      reassignRC(isReversed);      computeRowClusterSize();      computeAcompressed(isReversed);      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeRowCentroid(isReversed);      normalizeRowCentroid();      computeColCentroid(isReversed);      normalizeColCentroid();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("row", numIteration);    }        if (numColCluster < numCol){      reassignCC(isReversed);      computeColClusterSize();      computeAcompressed(isReversed);      isNormalizedCompressed = false;      normalizeCompressedMatrix();      computeRowCentroid(isReversed);      normalizeRowCentroid();      computeColCentroid(isReversed);      normalizeColCentroid();      computeObjectiveFunction4Normalized();      checkDumpLevel4BatchUpdate("col", numIteration);    }    rowSmoothingFactor *= myCRS->getAnnealingFactor();    colSmoothingFactor *= myCCS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  checkDumpLevel4BatchUpdate("end");}void MssrIIcc::doBatchUpdate4VariationI(bool *isReversed){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  computeRowClusterSize();  computeColClusterSize();  computeAcompressed(isReversed);  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid(isReversed);  normalizeRowCentroid();  computeColCentroid(isReversed);  normalizeColCentroid();  do {    numIteration++;    myCRS->setSmoothingFactor(smoothingType, rowSmoothingFactor);    myCCS->setSmoothingFactor(smoothingType, colSmoothingFactor);    oldObjValue = objValue;    reassignRC(isReversed);    computeRowClusterSize();						// Without this comment, it works...    computeAcompressed(isReversed);    isNormalizedCompressed = false;    normalizeCompressedMatrix();    computeRowCentroid(isReversed);    normalizeRowCentroid();    computeColCentroid(isReversed);    normalizeColCentroid();//    computeObjectiveFunction4Normalized();				// not working!!!//    checkDumpLevel4BatchUpdate("row", numIteration);//    computeObjectiveFunction4Normalized(Acompressed);				// not working!!!//    checkDumpLevel4BatchUpdate("row", numIteration);    computeObjectiveFunction4Normalized(Acompressed, isReversed);		// not working!!!    checkDumpLevel4BatchUpdate("row", numIteration);        reassignCC4Variation(isReversed);//    reassignCC(isReversed);    computeColClusterSize();/*    computeAcompressed(isReversed);    isNormalizedCompressed = false;    normalizeCompressedMatrix();    computeRowCentroid(isReversed);    normalizeRowCentroid();    computeColCentroid(isReversed);    normalizeColCentroid();*///    computeObjectiveFunction4Normalized();			// not working!!!    computeObjectiveFunction4Normalized(Acompressed, isReversed);    checkDumpLevel4BatchUpdate("col", numIteration);    computeAcompressed(isReversed);    isNormalizedCompressed = false;    normalizeCompressedMatrix();    computeRowCentroid(isReversed);    normalizeRowCentroid();    computeColCentroid(isReversed);    normalizeColCentroid();    computeObjectiveFunction4Normalized();    checkDumpLevel4BatchUpdate("both", numIteration);    rowSmoothingFactor *= myCRS->getAnnealingFactor();    colSmoothingFactor *= myCCS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));  checkDumpLevel4BatchUpdate("end");}void MssrIIcc::doBatchUpdate4VariationII(bool *isReversed){  checkDumpLevel4BatchUpdate("begin");  int numIteration = 0;  double oldObjValue;  double tempRowSmoothingFactor = rowSmoothingFactor, tempColSmoothingFactor = colSmoothingFactor;    computeRowClusterSize();  computeColClusterSize();  computeAcompressed(isReversed);  isNormalizedCompressed = false;  normalizeCompressedMatrix();  computeRowCentroid(isReversed);  normalizeRowCentroid();  computeColCentroid(isReversed);  normalizeColCentroid();  myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);  myCCS->setSmoothingFactor(smoothingType, tempColSmoothingFactor);  do {    numIteration++;    myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);    oldObjValue = objValue;    reassignRC(isReversed);    computeRowClusterSize();    computeAcompressed(isReversed);    isNormalizedCompressed = false;    normalizeCompressedMatrix();    computeRowCentroid(isReversed);    normalizeRowCentroid();    computeObjectiveFunction4Normalized();    checkDumpLevel4BatchUpdate("row", numIteration);    tempRowSmoothingFactor *= myCRS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (rowBatchUpdateThreshold * squaredFNormA));//------------  numIteration = 0;  tempRowSmoothingFactor = rowSmoothingFactor;  myCRS->setSmoothingFactor(smoothingType, tempRowSmoothingFactor);  do {    numIteration++;    myCCS->setSmoothingFactor(smoothingType, tempColSmoothingFactor);    oldObjValue = objValue;    reassignCC(isReversed);    computeColClusterSize();    computeAcompressed(isReversed);    isNormalizedCompressed = false;    normalizeCompressedMatrix();    computeColCentroid(isReversed);    normalizeColCentroid();    computeObjectiveFunction4Normalized();    checkDumpLevel4BatchUpdate("col", numIteration);    tempColSmoothingFactor *= myCCS->getAnnealingFactor();  } while ((oldObjValue - objValue) > (colBatchUpdateThreshold * squaredFNormA));  colSmoothingFactor = tempColSmoothingFactor;  checkDumpLevel4BatchUpdate("end");}/*// It doesn't guarantee the monotonic decrease of objective function values.void MssrIIcc::doBatchUpdate4VariationIII(bool *isReversed){  checkDumpLevel4BatchUpdate("begin");  bool *beforeIsReversed = new bool[numRow];  bool *afterIsReversed = new bool[numRow];  int numIteration = 0, numRowIteration = 0, numColIteration = 0;  int *beforeRowCL = new int[numRow];  int *afterRowCL = new int[numRow];  double oldObjValue;  double tempRowSmoothingFactor = rowSmoothingFactor, tempColSmoothingFactor = colSmoothingFactor;    computeRowClusterSize();  computeColClusterSize();

⌨️ 快捷键说明

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