mulan.evaluation.measure
Class InformationRetrievalMeasures

java.lang.Object
  extended by mulan.evaluation.measure.InformationRetrievalMeasures

public class InformationRetrievalMeasures
extends Object

Class for computing various information retrieval measures.

Version:
2012.05.29
Author:
Grigorios Tsoumakas

Constructor Summary
InformationRetrievalMeasures()
           
 
Method Summary
static double fMeasure(double tp, double fp, double fn, double beta)
          Computation of F-measure based on tp, fp, fn and beta.
static double precision(double tp, double fp, double fn)
          Computation of precision based on tp, fp and fn.
static double recall(double tp, double fp, double fn)
          Computation of recall based on tp, fp and fn.
static double specificity(double tn, double fp, double fn)
          Computation of specificity based on tn, fp and fn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InformationRetrievalMeasures

public InformationRetrievalMeasures()
Method Detail

fMeasure

public static double fMeasure(double tp,
                              double fp,
                              double fn,
                              double beta)
Computation of F-measure based on tp, fp, fn and beta. We treat special cases with empty set predictions or/and ground truth as follows: (i) if the algorithm outputs the empty set and the ground truth is the empty set, then we consider F equal to 1 (ii) if the algorithm outputs the empty set and the ground truth is not empty, then we consider F equal to 0 (iii) if the ground truth is empty and the algorithm does not output the empty set, then we consider F equal to 0 (iv) if neither the ground truth nor the algorithm's prediction is the empty set and their intersection is empty, then we consider F equal to 0.

Parameters:
tp - true positives
fp - false positives
fn - false negatives
beta - controls the relative importance of recall versus precision
Returns:
the value of the f-measure

precision

public static double precision(double tp,
                               double fp,
                               double fn)
Computation of precision based on tp, fp and fn. We treat special cases with empty set predictions or/and ground truth as follows: (i) if the algorithm outputs the empty set and the ground truth is the empty set, then we consider precision equal to 1 (ii) if the algorithm outputs the empty set and the ground truth is not empty, then we consider precision equal to 0.

Parameters:
tp - true positives
fp - false positives
fn - false negatives
Returns:
the value of precision

recall

public static double recall(double tp,
                            double fp,
                            double fn)
Computation of recall based on tp, fp and fn. We treat special cases with empty set predictions or/and ground truth as follows: (i) if the algorithm outputs the empty set and the ground truth is the empty set, then we consider recall equal to 1 (ii) if the algorithm does not output the empty set and the ground truth is empty, then we consider recall equal to 0.

Parameters:
tp - true positives
fp - false positives
fn - false negatives
Returns:
the value of recall

specificity

public static double specificity(double tn,
                                 double fp,
                                 double fn)
Computation of specificity based on tn, fp and fn. We treat special cases with empty set predictions or/and ground truth as follows: (i) if the algorithm outputs the set of all labels and the ground truth is the set of all labels, then we consider specificity equal to 1 (ii) if the ground truth is the set of all labels and the algorithm does not output the set of all labels, then we consider specificity equal to 0.

Parameters:
tn - true negatives
fp - false positives
fn - false negatives
Returns:
the value of specificity