Class FScore

java.lang.Object
  extended by FScore

public class FScore
extends java.lang.Object

This class implements the cubic time and quadratic time algorithms for computing the predictions maximizing the expected F-score under the label independence assumption. The algorithms are described in Nan Ye, Adam K.M. Chai, Wee Sun Lee, Hai Leong Chieu. Optimizing F-measures: A Tale of Two Approaches. ICML 2012. In this implementation, Fbeta = (1+beta)/(1/prec+beta/rec) , where prec and rec are the precision and recall respectively.


Constructor Summary
FScore()
           
 
Method Summary
static double expected_fscore(double[] p, int n, double beta)
          Return the Fbeta score when the first n instances are predicted as positive.
static double[] expected_fscores(double[] p, double beta)
          Return the Fbeta scores when the first n instances are predicted as positive, for all n.
static double[] expected_fscores(double[] p, int q, int r)
          Return the Fq/r scores when the first k instances are predicted as positive, for all k.
static void main(java.lang.String[] args)
           
static int[] max_expected_fscore_preds(double[] p, double beta)
          Return the predictions maximizing the expected Fbeta when the probabilities that the instances are positive are given by p.
static int[] max_expected_fscore_preds(double[] p, int q, int r)
          Return the predictions maximizing the expected Fq/r when the probabilities that the instances are positive are given by p.
static double max_expected_fscore(double[] p, double beta)
          Return the maximum expected Fbeta when the probabilities that the instances are positive are given by p
static double max_expected_fscore(double[] p, int q, int r)
          Return the maximum expected Fq/r when the probabilities that the instances are positive are given by p
static void test(double[] p, int q, int r)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FScore

public FScore()
Method Detail

max_expected_fscore

public static double max_expected_fscore(double[] p,
                                         int q,
                                         int r)
Return the maximum expected Fq/r when the probabilities that the instances are positive are given by p


max_expected_fscore_preds

public static int[] max_expected_fscore_preds(double[] p,
                                              int q,
                                              int r)
Return the predictions maximizing the expected Fq/r when the probabilities that the instances are positive are given by p.


expected_fscores

public static double[] expected_fscores(double[] p,
                                        int q,
                                        int r)
Return the Fq/r scores when the first k instances are predicted as positive, for all k.


max_expected_fscore

public static double max_expected_fscore(double[] p,
                                         double beta)
Return the maximum expected Fbeta when the probabilities that the instances are positive are given by p


max_expected_fscore_preds

public static int[] max_expected_fscore_preds(double[] p,
                                              double beta)
Return the predictions maximizing the expected Fbeta when the probabilities that the instances are positive are given by p.


expected_fscores

public static double[] expected_fscores(double[] p,
                                        double beta)
Return the Fbeta scores when the first n instances are predicted as positive, for all n.


expected_fscore

public static double expected_fscore(double[] p,
                                     int n,
                                     double beta)
Return the Fbeta score when the first n instances are predicted as positive.


test

public static void test(double[] p,
                        int q,
                        int r)

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException