Class ClassifierMetricGetter


  • public class ClassifierMetricGetter
    extends java.lang.Object
    Class for getting metrics by their name for single- and multilabel classifiers. This class allows for convenient access of individual metrics by name and can be used to list available metrics.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.List<java.lang.String> MULTI_LABEL_METRICS
      Available metrics for multilabelclassifiers
      protected static java.util.List<java.lang.String> SINGLE_LABEL_METRICS
      Available metric for singlelabelclassifiers
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> getMultiLabelMetrics()  
      static java.util.List<java.lang.String> getSingleLabelMetrics()  
      static double getValueOfMetricForSingleLabelClassifier​(weka.classifiers.Evaluation eval, java.lang.String metricName, int classIndex)
      Extracts the metric with the given name from the Evaluation object that is the result of evaluating a classifier.
      static double getValueOfMultilabelClassifier​(meka.core.Result result, java.lang.String metricName)
      Extracts the metric with the given name from the result of evaluating a multilabel classifier (Calls the corresponding method).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SINGLE_LABEL_METRICS

        protected static final java.util.List<java.lang.String> SINGLE_LABEL_METRICS
        Available metric for singlelabelclassifiers
      • MULTI_LABEL_METRICS

        protected static final java.util.List<java.lang.String> MULTI_LABEL_METRICS
        Available metrics for multilabelclassifiers
    • Method Detail

      • getSingleLabelMetrics

        public static java.util.List<java.lang.String> getSingleLabelMetrics()
      • getMultiLabelMetrics

        public static java.util.List<java.lang.String> getMultiLabelMetrics()
      • getValueOfMetricForSingleLabelClassifier

        public static double getValueOfMetricForSingleLabelClassifier​(weka.classifiers.Evaluation eval,
                                                                      java.lang.String metricName,
                                                                      int classIndex)
                                                               throws java.lang.Exception
        Extracts the metric with the given name from the Evaluation object that is the result of evaluating a classifier.
        Parameters:
        eval - The Evaluation object containing the results of evaluating a classifier
        metricName - The name of the metric to retrieve
        classIndex - The class index in the instances the classifier was evaluated on
        Returns:
        The value of the metric
        Throws:
        java.lang.Exception - If a metric cannot be retrieved
      • getValueOfMultilabelClassifier

        public static double getValueOfMultilabelClassifier​(meka.core.Result result,
                                                            java.lang.String metricName)
        Extracts the metric with the given name from the result of evaluating a multilabel classifier (Calls the corresponding method).
        Parameters:
        result - The result of evaluating the classifier
        metricName - The metric which should be retrieved
        Returns:
        The value of the metric