public class PRCurve
extends java.lang.Object
Constructor and Description |
---|
PRCurve(java.util.List<Pair<java.lang.Double,java.lang.Integer>> dataScores) |
PRCurve(java.lang.String filename)
reads scores with classes from a file, sorts by score and creates the arrays
|
PRCurve(java.lang.String filename,
boolean svm)
reads scores with classes from a file, sorts by score and creates the arrays
|
Modifier and Type | Method and Description |
---|---|
double |
accuracy() |
static boolean |
correct(double score,
int cls) |
double |
cwa()
confidence weighted accuracy assuming the scores are probabilities and using .5 as treshold
|
int[] |
cwaArray()
confidence weighted accuracy assuming the scores are probabilities and using .5 as treshold
|
static double |
f1(int tp,
int fp,
int fn) |
double |
fmeasure(int recall)
what is the f-measure at this recall if we look at the score as the probability of class 1 given x
as if coming from logistic regression same as logPrecision but calculating f-measure
|
double |
fmeasure(int numleft,
int numright)
the f-measure if we just guess as negative the first numleft and guess as positive the last numright
|
void |
init(java.util.List<Pair<java.lang.Double,java.lang.Integer>> dataScores) |
void |
initMC(java.util.ArrayList<Triple<java.lang.Double,java.lang.Integer,java.lang.Integer>> dataScores) |
double |
logLikelihood()
assuming the scores are probability of 1 given x
|
int |
logPrecision(int recall)
what is the precision at this recall if we look at the score as the probability of class 1 given x
as if coming from logistic regression
|
static void |
main(java.lang.String[] args) |
double |
opFmeasure() |
double |
optFmeasure(int recall)
what is the optimal f-measure we can achieve given recall guesses
using the optimal monotonic function
|
double |
optimalAccuracy() |
double |
optimalCwa()
optimal confidence weighted accuracy assuming for each recall we can fit an optimal monotonic function
|
int[] |
optimalCwaArray()
confidence weighted accuracy assuming the scores are probabilities and using .5 as threshold
|
int |
precision(int recall)
what is the best precision at the given recall
|
public PRCurve(java.lang.String filename)
public PRCurve(java.lang.String filename, boolean svm)
public PRCurve(java.util.List<Pair<java.lang.Double,java.lang.Integer>> dataScores)
public double optimalAccuracy()
public double accuracy()
public void init(java.util.List<Pair<java.lang.Double,java.lang.Integer>> dataScores)
public void initMC(java.util.ArrayList<Triple<java.lang.Double,java.lang.Integer,java.lang.Integer>> dataScores)
public int precision(int recall)
public static double f1(int tp, int fp, int fn)
public double fmeasure(int numleft, int numright)
public int logPrecision(int recall)
public double optFmeasure(int recall)
public double opFmeasure()
public double fmeasure(int recall)
recall
- make this many guesses for which we are most confidentpublic double logLikelihood()
public double cwa()
public int[] cwaArray()
public int[] optimalCwaArray()
public double optimalCwa()
public static boolean correct(double score, int cls)
public static void main(java.lang.String[] args)