/*! \file evaluate.c \brief Various routines to evaluate classification performance \author George \date 9/23/2008 \version\verbatim $Id: evaluate.c 13328 2012-12-31 14:57:40Z karypis $ \endverbatim */ #include "GKlib.h" /********************************************************************** * This function computes the max accuracy score of a ranked list, * given +1/-1 class list **********************************************************************/ float ComputeAccuracy(int n, gk_fkv_t *list) { int i, P, N, TP, FN = 0; float bAccuracy = 0.0; float acc; for (P=0, i=0;i bAccuracy) bAccuracy = acc; } return bAccuracy; } /***************************************************************************** * This function computes the ROC score of a ranked list, given a +1/-1 class * list. ******************************************************************************/ float ComputeROCn(int n, int maxN, gk_fkv_t *list) { int i, P, TP, FP, TPprev, FPprev, AUC; float prev; FP = TP = FPprev = TPprev = AUC = 0; prev = list[0].key -1; for (P=0, i=0; i 0 ? (float)(1.0*AUC/(P*FP)) : 0.0); } /***************************************************************************** * This function computes the median rate of false positive for each positive * instance. ******************************************************************************/ float ComputeMedianRFP(int n, gk_fkv_t *list) { int i, P, N, TP, FP; P = N = 0; for (i=0; i