Class EvaluationMetricHelper


  • public class EvaluationMetricHelper
    extends Object
    Helper routines for extracting metric values from built-in and plugin evaluation metrics.
    Version:
    $Revision$
    Author:
    Mark Hall (mhall{[at]}pentaho{[dot]}com)
    • Constructor Detail

      • EvaluationMetricHelper

        public EvaluationMetricHelper​(Evaluation eval)
        Construct a new EvaluationMetricHelper
        Parameters:
        eval - the Evaluation object to use
    • Method Detail

      • setEvaluation

        public void setEvaluation​(Evaluation eval)
        Sets the Evaluation object to use
        Parameters:
        eval - the Evaluation object to use
      • getBuiltInMetricNames

        public static List<String> getBuiltInMetricNames()
        Get a list of built-in metric names
        Returns:
        a list of built-in metric names
      • getPluginMetricNames

        public static List<String> getPluginMetricNames()
        Get a list of plugin metric names
        Returns:
        a list of plugin metric names
      • getAllMetricNames

        public static List<String> getAllMetricNames()
        Get a list of all available evaluation metric names
        Returns:
        a list of all available evaluation metric names
      • getNamedMetric

        public double getNamedMetric​(String statName,
                                     int... classValIndex)
                              throws Exception
        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.
        Parameters:
        statName - the name of the metric/statistic to get
        classValIndex - the optional class value index
        Returns:
        the value of the metric
        Throws:
        Exception - if the metric/stat is unknown or a problem occurs
      • getNamedMetricThresholds

        public double[] getNamedMetricThresholds​(String statName)
                                          throws Exception
        Gets the thresholds produced by the metric, if the metric implements ThresholdProducingMetric.
        Parameters:
        statName - the name of the metric/statistic to get
        Returns:
        the thresholds, null if metric does not produce any
        Throws:
        Exception - if the metric/stat is unknown or a problem occurs
      • metricIsMaximisable

        public boolean metricIsMaximisable​(String statName)
                                    throws Exception
        Returns true if the named metric is maximisable
        Parameters:
        statName - the name of the metric/statistic to check
        Returns:
        true if the metric in question is optimum at a maximal value
        Throws:
        Exception - if a problem occurs