/** * Returns the false negative rate for a given label * * @param classLabel the label * @return fnr as a double */ public double falseNegativeRate(Integer classLabel) { return falseNegativeRate(classLabel, DEFAULT_EDGE_VALUE); }
/** * False negative rate based on guesses so far * Takes into account all known classes and outputs average fnr across all of them * * @return the fnr for the outcomes */ public double falseNegativeRate() { return falseNegativeRate(EvaluationAveraging.Macro); }
/** * False Alarm Rate (FAR) reflects rate of misclassified to classified records * http://ro.ecu.edu.au/cgi/viewcontent.cgi?article=1058&context=isw * * @return the fpr for the outcomes */ public double falseAlarmRate() { return (falsePositiveRate() + falseNegativeRate()) / 2.0; }
/** * Calculate the average false negative rate for all classes - can specify whether macro or micro averaging should be used * * @param averaging Averaging method - macro or micro * @return Average false negative rate */ public double falseNegativeRate(EvaluationAveraging averaging) { int nClasses = confusion().getClasses().size(); if (averaging == EvaluationAveraging.Macro) { double macroFNR = 0.0; for (int i = 0; i < nClasses; i++) { macroFNR += falseNegativeRate(i); } macroFNR /= nClasses; return macroFNR; } else if (averaging == EvaluationAveraging.Micro) { long fnCount = 0; long tnCount = 0; for (int i = 0; i < nClasses; i++) { fnCount += falseNegatives.getCount(i); tnCount += trueNegatives.getCount(i); } return EvaluationUtils.falseNegativeRate(fnCount, tnCount, DEFAULT_EDGE_VALUE); } else { throw new UnsupportedOperationException("Unknown averaging approach: " + averaging); } }