Class EvaluationUtils


  • public class EvaluationUtils
    extends Object
    • Constructor Detail

      • EvaluationUtils

        public EvaluationUtils()
    • Method Detail

      • precision

        public static double precision​(long tpCount,
                                       long fpCount,
                                       double edgeCase)
        Calculate the precision from true positive and false positive counts
        Parameters:
        tpCount - True positive count
        fpCount - False positive count
        edgeCase - Edge case value use to avoid 0/0
        Returns:
        Precision
      • recall

        public static double recall​(long tpCount,
                                    long fnCount,
                                    double edgeCase)
        Calculate the recall from true positive and false negative counts
        Parameters:
        tpCount - True positive count
        fnCount - False negative count
        edgeCase - Edge case values used to avoid 0/0
        Returns:
        Recall
      • falsePositiveRate

        public static double falsePositiveRate​(long fpCount,
                                               long tnCount,
                                               double edgeCase)
        Calculate the false positive rate from the false positive count and true negative count
        Parameters:
        fpCount - False positive count
        tnCount - True negative count
        edgeCase - Edge case values are used to avoid 0/0
        Returns:
        False positive rate
      • falseNegativeRate

        public static double falseNegativeRate​(long fnCount,
                                               long tpCount,
                                               double edgeCase)
        Calculate the false negative rate from the false negative counts and true positive count
        Parameters:
        fnCount - False negative count
        tpCount - True positive count
        edgeCase - Edge case value to use to avoid 0/0
        Returns:
        False negative rate
      • fBeta

        public static double fBeta​(double beta,
                                   long tp,
                                   long fp,
                                   long fn)
        Calculate the F beta value from counts
        Parameters:
        beta - Beta of value to use
        tp - True positive count
        fp - False positive count
        fn - False negative count
        Returns:
        F beta
      • fBeta

        public static double fBeta​(double beta,
                                   double precision,
                                   double recall)
        Calculate the F-beta value from precision and recall
        Parameters:
        beta - Beta value to use
        precision - Precision
        recall - Recall
        Returns:
        F-beta value
      • gMeasure

        public static double gMeasure​(double precision,
                                      double recall)
        Calculate the G-measure from precision and recall
        Parameters:
        precision - Precision value
        recall - Recall value
        Returns:
        G-measure
      • matthewsCorrelation

        public static double matthewsCorrelation​(long tp,
                                                 long fp,
                                                 long fn,
                                                 long tn)
        Calculate the binary Matthews correlation coefficient from counts
        Parameters:
        tp - True positive count
        fp - False positive counts
        fn - False negative counts
        tn - True negative count
        Returns:
        Matthews correlation coefficient
      • reshapeTimeSeriesTo2d

        public static INDArray reshapeTimeSeriesTo2d​(INDArray labels)
      • reshapeTimeSeriesMaskToVector

        public static INDArray reshapeTimeSeriesMaskToVector​(INDArray timeSeriesMask)
        Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer
        Parameters:
        timeSeriesMask - Mask array to reshape to a column vector
        Returns:
        Mask array as a column vector