### Question:
RankingEvaluator extends Evaluator { public double negativeAUPRC() { int totalPositives = 0; for (GroundAtom atom : truth) { if (atom.getValue() > threshold) { totalPositives++; } } int totalNegatives = predicted.size() - totalPositives; if (totalNegatives == 0) { return 0.0; } double area = 0.0; int fn = totalPositives; int tn = totalNegatives; double prevY = tn / (double)(tn + fn); double prevX = 1.0; for (GroundAtom atom : predicted) { Boolean label = getLabel(atom); if (label == null) { continue; } if (label != null && label) { fn--; } else { tn--; } double newY = 0.0; if (tn + fn > 0) { newY = tn / (double)(tn + fn); } double newX = tn / (double)totalNegatives; area += 0.5 * (prevX - newX) * (prevY + newY); prevY = newY; prevX = newX; } return area; } RankingEvaluator();  RankingEvaluator(double threshold);  RankingEvaluator(double threshold, String representative);  RankingEvaluator(double threshold, RepresentativeMetric representative); @Override void compute(TrainingMap trainingMap); @Override void compute(TrainingMap trainingMap, StandardPredicate predicate); @Override double getRepresentativeMetric(); @Override boolean isHigherRepresentativeBetter(); double getThreshold(); double positiveAUPRC(); double negativeAUPRC(); double auroc(); @Override String getAllStats(); static final String CONFIG_PREFIX; static final String THRESHOLD_KEY; static final double DEFAULT_THRESHOLD; static final String REPRESENTATIVE_KEY; static final String DEFAULT_REPRESENTATIVE; }### Answer:
@Test public void testNegativeAUPRC() { for (double threshold = 0.1; threshold <= 1.0; threshold += 0.1) { RankingEvaluator computer = new RankingEvaluator(threshold); computer.compute(trainingMap, predicate); double value = computer.negativeAUPRC(); if (threshold <= 0.8) { assertEquals("Threshold: " + threshold, 0.5, value, MathUtils.EPSILON); } else { assertEquals("Threshold: " + threshold, 0.5, value, MathUtils.EPSILON); } } }