public class ConfusionMatrix extends Object
| Constructor and Description |
|---|
ConfusionMatrix() |
| Modifier and Type | Method and Description |
|---|---|
static ConfusionMatrix |
createCumulativeMatrix(ConfusionMatrix... matrices)
Sums up all matrices into a new one
|
double |
getAccuracy() |
double |
getAvgPrecision() |
double |
getAvgRecall() |
double |
getCohensKappa()
Computes Cohen's Kappa
|
int |
getColSum(String label) |
double |
getConfidence90Accuracy()
Returns the half of the confidence interval on accuracy on alpha = 90
|
double |
getConfidence90AccuracyHigh() |
double |
getConfidence90AccuracyLow() |
double |
getConfidence90MacroFM() |
double |
getConfidence95Accuracy()
Returns the half of the confidence interval on accuracy on alpha = 95
|
double |
getConfidence95AccuracyHigh()
Returns the upper bound of the accuracy with alpha = 95
|
double |
getConfidence95AccuracyLow()
Returns the lower bound of the accuracy with alpha = 95
|
double |
getConfidence95MacroFM()
Returns the half of confidence interval on alpha = 95 (see
http://alias-i.com/lingpipe/docs/api/com/aliasi/classify/ConfusionMatrix.html#confidence95%28%29)
|
double |
getConfidence95MacroFMHigh()
Returns the upper bound of the macro F-measure with alpha = 95
|
double |
getConfidence95MacroFMLow()
Returns the lower bound of the macro F-measure with alpha = 95
|
Map<String,Double> |
getFMeasureForLabels()
Returns F-measure for categories; see See http://en.wikipedia.org/wiki/F1_score
|
Map<String,Double> |
getFMeasureForLabels(double beta)
See http://en.wikipedia.org/wiki/F1_score
|
List<String> |
getLabelSeries()
Returns the series of actual labels
|
double |
getMacroFMeasure()
Macro-averaged F-measure gives equal
weight to each category, regardless of its frequency.
|
double |
getMacroFMeasure(double beta)
Macro-averaged F-measure with beta parameter.
|
double |
getMicroFMeasure()
Micro-averaged F-measure gives equal weight to each document and is therefore
considered as an average over all the document/category pairs.
|
double |
getPrecisionForLabel(String label) |
Map<String,Double> |
getPrecisionForLabels() |
double |
getRecallForLabel(String label)
Return recall for single label
|
Map<String,Double> |
getRecallForLabels()
Return recall for labels
|
int |
getRowSum(String label) |
ConfusionMatrix |
getSymmetricConfusionMatrix()
Returns C + C^T - InC (this + transposed this - unit matrix * this), see
See
Silvie Cinkova, Martin Holub, and Vincent Kriz. 2012.
|
int |
getTotalSum() |
ConfusionMatrix |
getTransposedMatrix()
Returns transposed confusion matrix (gold and predicted are switched)
|
void |
increaseValue(String goldValue,
String observedValue) |
void |
increaseValue(String goldValue,
String observedValue,
int times)
Increases value of goldValue x observedValue n times
|
static ConfusionMatrix |
parseFromText(String text)
Confusion matrix printed to text by toString can be parsed back
|
String |
printClassDistributionGold()
Returns a distribution of classes in gold data and predicted data (absolute
and relative)
|
String |
printLabelPrecRecFm() |
String |
printNiceResults() |
void |
setNumberOfDecimalPlaces(int numberOfDecimalPlaces) |
protected String |
tableToString(List<List<String>> table) |
String |
toString() |
String |
toStringLatex()
Prints in LaTeX format
|
String |
toStringProbabilistic()
Returns probabilistic confusion matrix (as table String)
|
public void setNumberOfDecimalPlaces(int numberOfDecimalPlaces)
throws IllegalArgumentException
IllegalArgumentExceptionpublic List<String> getLabelSeries()
public void increaseValue(String goldValue, String observedValue, int times)
goldValue - expobservedValue - actimes - n-timespublic double getAccuracy()
public int getTotalSum()
public int getRowSum(String label)
public int getColSum(String label)
public double getPrecisionForLabel(String label)
public double getMicroFMeasure()
public double getMacroFMeasure()
public double getMacroFMeasure(double beta)
beta - beta parameterpublic Map<String,Double> getFMeasureForLabels()
public Map<String,Double> getFMeasureForLabels(double beta)
beta - beta paremeter; higher than 1 prefers recall, lower than 1 prefers precisionpublic Map<String,Double> getRecallForLabels()
public double getRecallForLabel(String label)
label - labelpublic double getConfidence95Accuracy()
public double getConfidence90Accuracy()
public double getConfidence90AccuracyLow()
public double getConfidence90AccuracyHigh()
public double getConfidence95AccuracyLow()
public double getConfidence95AccuracyHigh()
public double getConfidence95MacroFM()
public double getConfidence90MacroFM()
public double getConfidence95MacroFMLow()
public double getConfidence95MacroFMHigh()
public double getCohensKappa()
public String toStringLatex()
public String printNiceResults()
public String printLabelPrecRecFm()
public double getAvgPrecision()
public double getAvgRecall()
public static ConfusionMatrix createCumulativeMatrix(ConfusionMatrix... matrices)
matrices - confusion matricespublic ConfusionMatrix getSymmetricConfusionMatrix()
public ConfusionMatrix getTransposedMatrix()
public static ConfusionMatrix parseFromText(String text) throws IllegalArgumentException
text - input textIllegalArgumentException - if input is malformedpublic String printClassDistributionGold()
public String toStringProbabilistic()
Copyright © 2015. All rights reserved.