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

📄 tools.cc

📁 一种聚类算法,名字是cocluster
💻 CC
📖 第 1 页 / 共 5 页
字号:
    case MSSRCC_II_ALGORITHM:      myCLA.algorithmType = MINIMUM_SUM_SQUARE_RESIDUE_II_CC;      break;    default:      cout << "  !!! Invalid algorithm type: " << *argv << " !!!" << endl << endl;      validCLA = false;      break;  }  if (!validCLA){    printAlgorithmType();    myCLA.numInvalidCLA++;  }  return argv;}// get # of column clusters from command-line...char **getColClusterNum(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid # of column cluster(s): (# of column cluster(s) should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){    cout << "  !!! Invalid # of column cluster(s): " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  int tempNum = atoi(*(argv+1));  if (tempNum <= 0){    cout << "  !!! Invalid # of column cluster(s): (# of column cluster(s) should be a positive integer.): " << tempNum << " !!!" << endl;    validCLA = false;  }  if (validCLA)    myCLA.numColCluster = atoi(*(++argv));  if (!validCLA){    printColClusterNum();    myCLA.numInvalidCLA++;  }  return argv;}// get dump-level from command-line...char **getDumpLevel(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid dump level: (dump level should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){    cout << "  !!! Invalid dump level: " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    myCLA.dumpLevel = atoi(*(++argv));    if ((myCLA.dumpLevel < MINIMUM_DUMP_LEVEL) || (myCLA.dumpLevel > MAXIMUM_DUMP_LEVEL)){      cout << "  !!! Invalid dump level: " << myCLA.dumpLevel << " !!!" << endl << endl;      validCLA = false;    }  }  if (validCLA && (myCLA.dumpLevel == MAXIMUM_DUMP_LEVEL)){    switch (toupper((*(++argv))[0])){      case APPEND_OUT:        myCLA.dumpAccessMode = APPEND_MODE;	break;      case OUTPUT_OUT:        myCLA.dumpAccessMode = OUTPUT_MODE;	break;      default:	cout << "  !!! Invalid dump file access mode: " << *argv << " !!!" << endl << endl;        validCLA = false;        break;    }    if (validCLA && (*(argv+1) == NULL)){      cout << "  !!! Invalid dump filename: (dump filename should be specified.) !!!" << endl << endl;      validCLA = false;    }    if (validCLA && (isdigit((*(argv+1))[0]) || ((*(argv+1))[0] == '-'))){      cout << "  Invalid dump filename: " << *(argv+1) << endl << endl;      validCLA = false;    }    if (validCLA)      strcpy(myCLA.dumpFilename, *(++argv));  }  if (!validCLA){    printOutputLabelType();    myCLA.numInvalidCLA++;  }  return argv;}// get information of showing a CM and each cluster's statistics...char **getShowingEachCluster(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid parameter: (0 or 1 should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){    cout << "  !!! Invalid parameter: " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    switch (atoi(*(++argv))){      case ON:        myCLA.showingEachCluster = true;	break;      case OFF:        myCLA.showingEachCluster = false;	break;      default:        cout << " !!! Invalid parameter: (0 or 1 should be specified.): " << myCLA.numRun << " !!!" << endl << endl;        validCLA = false;	break;    }  }  if (!validCLA){    printShowingEachCluster();    myCLA.numInvalidCLA++;  }  return argv;}// get input file information from command-line...char **getInputFileInformation(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  switch (toupper((*(++argv))[0])){    case DENSE_INPUT:      myCLA.inputMatrixType = DENSE_MATRIX;      switch (toupper((*(++argv))[0])){	case SEPARATE_INPUT:	  myCLA.inputFormatType = DIM_MATRIX_SEPARATE_FORMAT;	  break;        case TOGETHER_INPUT:          myCLA.inputFormatType = DIM_MATRIX_TOGETHER_FORMAT;	  break;        default:          cout << "  !!! Invalid dense matrix format type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      break;    case SPARSE_INPUT:      myCLA.inputMatrixType = SPARSE_MATRIX;      switch (toupper((*(++argv))[0])){	case TFN_INPUT:	  strcpy(myCLA.scalingType, TFN_SCALING);	// In fact, it's not used.	  myCLA.inputFormatType = TFN_FILE_FORMAT;	  break;        case TXX_INPUT:          strcpy(myCLA.scalingType, TXX_SCALING);	// In fact, it's not used	  myCLA.inputFormatType = TXX_FILE_FORMAT;	  break;        default:          cout << "  !!! Invalid sparse matrix format type: " << *argv << " !!!" << endl << endl;          validCLA = false;	  break;      }      break;    default:        cout << "  !!! Invalid input matrix argument(s): " << *argv << " !!!" << endl << endl;      validCLA = false;      break;  }  if (validCLA && ((*(++argv))[0] != '-')){    sprintf(myCLA.inputFilename, "%s",*argv);    if (strcmp(myCLA.coclusterFilename, "") == 0)      extractFilename(*argv, myCLA.coclusterFilename);    strcpy(myCLA.dumpFilename, myCLA.coclusterFilename);    strcpy(myCLA.objectiveFilename, myCLA.coclusterFilename);    myCLA.havingArgument = true;  } else {     cout << "  !!! Invalid input matrix argument(s): " << *argv << " !!!" << endl << endl;     validCLA = false;  }  if (!validCLA){    printInputMatrixType();    myCLA.numInvalidCLA++;  }  return argv;}// get information of computing one-way clustering objective function values from command-line...char **getComputingOneWayObjective(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid parameter: (0 or 1 should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){    cout << "  !!! Invalid parameter: " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    switch (atoi(*(++argv))){      case ON:        myCLA.computingOneWayObjective = true;	break;      case OFF:        myCLA.computingOneWayObjective = false;	break;      default:        cout << " !!! Invalid parameter: (0 or 1 should be specified.): " << myCLA.numRun << " !!!" << endl << endl;        validCLA = false;	break;    }  }  if (!validCLA){    printComputingOneWayObject();    myCLA.numInvalidCLA++;  }  return argv;}// get class (label) file information from command-line...	  char **getClassFileInformation(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  switch (toupper((*(++argv))[0])){    case BOTH_LABEL:      myCLA.externalValidityType = BOTH_EXTERNAL_VALIDITY;      break;    case COL_LABEL:      myCLA.externalValidityType = COL_EXTERNAL_VALIDITY;      break;    case ROW_LABEL:      myCLA.externalValidityType = ROW_EXTERNAL_VALIDITY;      break;    default:      cout << "  !!! Invalid class matrix selection: " << *argv << " !!!" << endl << endl;      validCLA = false;      break;  }  if (validCLA){    switch ((*(++argv))[0]){      case LABEL_FROM_0:        myCLA.classOffsetType = START_FROM_0;        break;      case LABEL_FROM_1:        myCLA.classOffsetType = START_FROM_1;        break;      default:        cout << "  !!! Invalid class matrix offset type: " << *argv << " !!!" << endl << endl;        validCLA = false;        break;    }  }  if (validCLA && (*(argv+1) == NULL)){    cout << "  !!! Invalid class filename: (class filename should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && (isdigit((*(argv+1))[0]) || ((*(argv+1))[0] == '-'))){    cout << "  !!! Invalid class filename: " << *(argv+1) << " !!!" << endl << endl;    validCLA = false;  }  if (validCLA){    switch (myCLA.externalValidityType){      case BOTH_EXTERNAL_VALIDITY:        strcpy(myCLA.bothClassFilename, *(++argv));        break;      case COL_EXTERNAL_VALIDITY:        strcpy(myCLA.colClassFilename, *(++argv));        break;      case ROW_EXTERNAL_VALIDITY:        strcpy(myCLA.rowClassFilename, *(++argv));        break;      default:        validCLA = false;	break;    }  }        if (!validCLA){    printClassLabelSelection();    myCLA.numInvalidCLA++;  }  return argv;}/*// get length of local search from command-line...char **getLocalSearchLength(int argc, char **argv, commandLineArgument &myCLA){  myCLA.localSearchLength = atoi(*(++argv));  return argv;}*/// get type of smoothing from command-line...char **getSmoothingType(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  char tempSmoothingType = toupper((*(++argv))[0]);  switch (tempSmoothingType){    case ANNEALING_TYPE:      break;    case MAXIMUM_ENTROPY_TYPE:      myCLA.smoothingType = MAXIMUM_ENTROPY_SMOOTHING;      break;    case NO_TYPE:      myCLA.smoothingType = NO_SMOOTHING;      break;    case UNIFORM_TYPE:      myCLA.smoothingType = UNIFORM_SMOOTHING;      break;    default:      cout << "  !!! Invalid smoothing type: " << *argv << " !!!" << endl << endl;      validCLA = false;      break;  }  if (validCLA && (tempSmoothingType != NO_TYPE)){    if (*(argv+1) == NULL){      cout << "  !!! Invalid row smoothing magnitude: (row smoothing magnitude should be specified.) !!!" << endl << endl;      validCLA = false;    }    if (validCLA && (!isdigit((*(argv+1))[0]) && ((*(argv+1))[0] != '.'))){      cout << "  !!! Invalid row smoothing magnitude: " << *(argv+1) << " !!!" << endl << endl;      validCLA = false;    }    if (validCLA && (*(argv+2) == NULL)){      cout << "  !!! Invalid col smoothing magnitude: (col smoothing magnitude should be specified.) !!!" << endl << endl;      validCLA = false;    }    if (validCLA && (!isdigit((*(argv+2))[0]) && ((*(argv+2))[0] != '.'))){      cout << "  !!! Invalid col smoothing magnitude: " << *(argv+2) << " !!!" << endl << endl;      validCLA = false;    }    if (validCLA){      switch (tempSmoothingType){        case ANNEALING_TYPE:          myCLA.rowAnnealingFactor = atof(*(++argv));          myCLA.colAnnealingFactor = atof(*(++argv));	  break;        case MAXIMUM_ENTROPY_TYPE:        case UNIFORM_TYPE:          myCLA.rowSmoothingFactor = atof(*(++argv));          myCLA.colSmoothingFactor = atof(*(++argv));          break;        case NO_TYPE:          break;        default:          cout << "  !!! Invalid smoothing parameter(s): " << *argv << " !!!" << endl << endl;          validCLA = false;        break;      }    }  }    if (!validCLA){    printSmoothingType();    myCLA.numInvalidCLA++;  }  return argv;}// get number of co-clustering running(s) from command-line...char **getRunNum(int argc, char **argv, commandLineArgument &myCLA){  bool validCLA = true;  if (*(argv+1) == NULL){    cout << "  !!! Invalid # of run(s): (# of runs should be specified.) !!!" << endl << endl;    validCLA = false;  }  if (validCLA && !isdigit((*(argv+1))[0])){

⌨️ 快捷键说明

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