/** * Returns the area under precision-recall curve (AUPRC) 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 precision-recall curve or not a number */ public double areaUnderPRC(int classIndex) { return m_delegate.areaUnderPRC(classIndex); }
/** * Returns the area under precision-recall curve (AUPRC) 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 precision-recall curve or not a number */ public double areaUnderPRC(int classIndex) { return m_delegate.areaUnderPRC(classIndex); }
/** * Calculates the weighted (by class size) AUPRC. * * @return the weighted AUPRC. */ public double weightedAreaUnderPRC() { 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 auprcTotal = 0; for (int i = 0; i < m_NumClasses; i++) { double temp = areaUnderPRC(i); if (classCounts[i] > 0) { // If temp is NaN, we want the sum to also be NaN if count > 0 auprcTotal += (temp * classCounts[i]); } } return auprcTotal / classCountSum; }
/** * Calculates the weighted (by class size) AUPRC. * * @return the weighted AUPRC. */ public double weightedAreaUnderPRC() { 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 auprcTotal = 0; for (int i = 0; i < m_NumClasses; i++) { double temp = areaUnderPRC(i); if (classCounts[i] > 0) { // If temp is NaN, we want the sum to also be NaN if count > 0 auprcTotal += (temp * classCounts[i]); } } return auprcTotal / classCountSum; }
double prcVal = areaUnderPRC(i); if (Utils.isMissingValue(prcVal)) { text.append("? ");
double prcVal = areaUnderPRC(i); if (Utils.isMissingValue(prcVal)) { text.append("? ");
vals[offset++] = eval.fMeasure(i); vals[offset++] = eval.areaUnderROC(i); vals[offset++] = eval.areaUnderPRC(i);
.weightedAreaUnderROC(); case 24: return hasValIndex ? m_eval.areaUnderPRC(classValIndex[0]) : m_eval .weightedAreaUnderPRC();
.weightedAreaUnderROC(); case 24: return hasValIndex ? m_eval.areaUnderPRC(classValIndex[0]) : m_eval .weightedAreaUnderPRC();