/** * Returns the area under ROC for those predictions that have been collected * in the evaluateClassifier(Classifier, Instances) method. Returns * Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the ROC curve or not a number */ public double areaUnderROC(int classIndex) { return m_delegate.areaUnderROC(classIndex); }
/** * Returns the area under ROC for those predictions that have been collected * in the evaluateClassifier(Classifier, Instances) method. Returns * Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the ROC curve or not a number */ public double areaUnderROC(int classIndex) { return m_delegate.areaUnderROC(classIndex); }
/** * Calculates the weighted (by class size) AUC. * * @return the weighted AUC. */ public double weightedAreaUnderROC() { double[] classCounts = new double[m_NumClasses]; double classCountSum = 0; for (int i = 0; i < m_NumClasses; i++) { for (int j = 0; j < m_NumClasses; j++) { classCounts[i] += m_ConfusionMatrix[i][j]; } classCountSum += classCounts[i]; } double aucTotal = 0; for (int i = 0; i < m_NumClasses; i++) { double temp = areaUnderROC(i); if (classCounts[i] > 0) { // If temp is NaN, we want the sum to also be NaN if count > 0 aucTotal += (temp * classCounts[i]); } } return aucTotal / classCountSum; }
/** * Calculates the weighted (by class size) AUC. * * @return the weighted AUC. */ public double weightedAreaUnderROC() { double[] classCounts = new double[m_NumClasses]; double classCountSum = 0; for (int i = 0; i < m_NumClasses; i++) { for (int j = 0; j < m_NumClasses; j++) { classCounts[i] += m_ConfusionMatrix[i][j]; } classCountSum += classCounts[i]; } double aucTotal = 0; for (int i = 0; i < m_NumClasses; i++) { double temp = areaUnderROC(i); if (classCounts[i] > 0) { // If temp is NaN, we want the sum to also be NaN if count > 0 aucTotal += (temp * classCounts[i]); } } return aucTotal / classCountSum; }
double rocVal = areaUnderROC(i); if (Utils.isMissingValue(rocVal)) { text.append("? ");
double rocVal = areaUnderROC(i); if (Utils.isMissingValue(rocVal)) { text.append("? ");
vals[offset++] = eval.recall(i); vals[offset++] = eval.fMeasure(i); vals[offset++] = eval.areaUnderROC(i); vals[offset++] = eval.areaUnderPRC(i);
assertTrue(Utils.isMissingValue(eval.areaUnderROC(0))); assertTrue(Utils.isMissingValue(aggregated.areaUnderROC(0)));
assertTrue(!Utils.isMissingValue(eval.areaUnderROC(0)));
assertTrue(Utils.isMissingValue(eval.areaUnderROC(0)));
assertTrue(!Utils.isMissingValue(eval.areaUnderROC(0)));
assertTrue(Utils.isMissingValue(eval.areaUnderROC(0)));
.weightedMatthewsCorrelation(); case 23: return hasValIndex ? m_eval.areaUnderROC(classValIndex[0]) : m_eval .weightedAreaUnderROC(); case 24:
.weightedMatthewsCorrelation(); case 23: return hasValIndex ? m_eval.areaUnderROC(classValIndex[0]) : m_eval .weightedAreaUnderROC(); case 24: