int[] s = Utils.sort(m_rankResults[0]); for (int i = s.length - 1; i >= 0; i--) { CvString.append(Utils.doubleToString(m_rankResults[0][s[i]], 6, 3)
int[] s = Utils.sort(m_rankResults[1]); for (int i=0; i<s.length; i++) { CvString.append(Utils.doubleToString(Math.abs(m_rankResults[0][s[i]]), 6, 3)
  public String CVResultsString () throws Exception {    StringBuffer CvString = new StringBuffer();        if ((m_subsetResults == null && m_rankResults == null) ||	( m_trainInstances == null)) {      throw new Exception("Attribute selection has not been performed yet!");    }    int fieldWidth = (int)(Math.log(m_trainInstances.numAttributes()) +1.0);    CvString.append("\n\n=== Attribute selection " + m_numFolds 		    + " fold cross-validation ");    if (!(m_ASEvaluator instanceof UnsupervisedSubsetEvaluator) && 	!(m_ASEvaluator instanceof UnsupervisedAttributeEvaluator) &&	(m_trainInstances.classAttribute().isNominal())) {	CvString.append("(stratified), seed: ");	CvString.append(m_seed+" ===\n\n");    }    else {      CvString.append("seed: "+m_seed+" ===\n\n");    }    if ((m_searchMethod instanceof RankedOutputSearch) && (m_doRank == true)) {      CvString.append("average merit      average rank  attribute\n");      // calcualte means and std devs      for (int i = 0; i < m_rankResults[0].length; i++) {	m_rankResults[0][i] /= m_numFolds; // mean merit	double var = m_rankResults[0][i]*m_rankResults[0][i]*m_numFolds;	var = (m_rankResults[2][i] - var);	var /= m_numFolds;	if (var <= 0.0) {	  var = 0.0;	  m_rankResults[2][i] = 0;	}	else {	  m_rankResults[2][i] = Math.sqrt(var);	}	m_rankResults[1][i] /= m_numFolds; // mean rank	var = m_rankResults[1][i]*m_rankResults[1][i]*m_numFolds;	var = (m_rankResults[3][i] - var);	var /= m_numFolds;	if (var <= 0.0) {	  var = 0.0;	  m_rankResults[3][i] = 0;	}	else {	  m_rankResults[3][i] = Math.sqrt(var);	}      }      // now sort them by mean merit      int[] s = Utils.sort(m_rankResults[0]);      for (int i = s.length - 1; i >= 0; i--) {	CvString.append(Utils.doubleToString(m_rankResults[0][s[i]], 6, 3) 			+ " +-" 			+ Utils.doubleToString(m_rankResults[2][s[i]], 6, 3) 			+ "   " 			+ Utils.doubleToString(m_rankResults[1][s[i]],					       fieldWidth+2, 1) 			+ " +-" 			+ Utils.doubleToString(m_rankResults[3][s[i]], 5, 2) 			+"  "			+ Utils.doubleToString(((double)(s[i] + 1)), 					       fieldWidth, 0)			+ " " 			+ m_trainInstances.attribute(s[i]).name() 			+ "\n");      }    }    else {      CvString.append("number of folds (%)  attribute\n");      for (int i = 0; i < m_subsetResults.length; i++) {	CvString.append(Utils.doubleToString(m_subsetResults[i], 12, 0) 			+ "(" 			+ Utils.doubleToString((m_subsetResults[i] / 						m_numFolds * 100.0)					       , 3, 0) 			+ " %)  " 			+ Utils.doubleToString(((double)(i + 1)),					       fieldWidth, 0)			+ " " 			+ m_trainInstances.attribute(i).name() 			+ "\n");      }    }    return CvString.toString();  }