/** * Gets the value of a named metric. For information retrieval metrics if a * class value index is not supplied then the class weighted variant is * returned. * * @param statName the name of the metric/statistic to get * @param classValIndex the optional class value index * @return the value of the metric * @throws Exception if the metric/stat is unknown or a problem occurs */ public double getNamedMetric(String statName, int... classValIndex) throws Exception { if (classValIndex != null && classValIndex.length > 1) { throw new IllegalArgumentException( "Only one class value index should be supplied"); } Integer builtinIndex = m_builtin.get(statName.toLowerCase()); if (builtinIndex != null) { return getBuiltinMetricValue(builtinIndex.intValue(), classValIndex); } else { AbstractEvaluationMetric m = m_pluginMetrics.get(statName.toLowerCase()); if (m == null) { throw new Exception("Unknown evaluation metric: " + statName); } return getPluginMetricValue(m, statName, classValIndex); } }
/** * Gets the value of a named metric. For information retrieval metrics if a * class value index is not supplied then the class weighted variant is * returned. * * @param statName the name of the metric/statistic to get * @param classValIndex the optional class value index * @return the value of the metric * @throws Exception if the metric/stat is unknown or a problem occurs */ public double getNamedMetric(String statName, int... classValIndex) throws Exception { if (classValIndex != null && classValIndex.length > 1) { throw new IllegalArgumentException( "Only one class value index should be supplied"); } Integer builtinIndex = m_builtin.get(statName.toLowerCase()); if (builtinIndex != null) { return getBuiltinMetricValue(builtinIndex.intValue(), classValIndex); } else { AbstractEvaluationMetric m = m_pluginMetrics.get(statName.toLowerCase()); if (m == null) { throw new Exception("Unknown evaluation metric: " + statName); } return getPluginMetricValue(m, statName, classValIndex); } }