* @param expected Expected AUC value
*/
protected void testAUC(Database db, String positive, OutlierResult result, double expected) {
ListParameterization params = new ListParameterization();
params.addParameter(ComputeROCCurve.POSITIVE_CLASS_NAME_ID, positive);
ComputeROCCurve rocCurve = ClassGenericsUtil.parameterizeOrAbort(ComputeROCCurve.class, params);
// Ensure the result has been added to the hierarchy:
if(db.getHierarchy().getParents(result).size() < 1) {
db.getHierarchy().add(db, result);
}
// Compute ROC and AUC:
rocCurve.processNewResult(db, result);
// Find the ROC results
Iterator<ComputeROCCurve.ROCResult> iter = ResultUtil.filteredResults(result, ComputeROCCurve.ROCResult.class);
org.junit.Assert.assertTrue("No ROC result found.", iter.hasNext());
double auc = iter.next().getAUC();
org.junit.Assert.assertFalse("More than one ROC result found.", iter.hasNext());