U
- the class label typepublic class ConfusionMatrix<U>
extends java.lang.Object
Confusion<String> myConf = new Confusion<String>();
myConf.add("l1", "l1");
myConf.add("l1", "l2");
myConf.add("l2", "l2");
System.out.println(myConf.toString());
NOTES: - This sorts by the toString() of the guess and gold labels. Thus the
label.toString() values should be distinct!Modifier and Type | Class and Description |
---|---|
class |
ConfusionMatrix.Contingency
Contingency table, listing precision ,recall, specificity, and f1 given
the number of true and false positives, true and false negatives.
|
Modifier and Type | Field and Description |
---|---|
protected java.text.DecimalFormat |
format |
Constructor and Description |
---|
ConfusionMatrix() |
ConfusionMatrix(java.util.Locale locale) |
Modifier and Type | Method and Description |
---|---|
void |
add(U guess,
U gold)
Increments the entry for this guess and gold by 1.
|
void |
add(U guess,
U gold,
int increment)
Increments the entry for this guess and gold by the given increment amount.
|
java.lang.Integer |
get(U guess,
U gold)
Retrieves the number of entries with this guess and gold.
|
ConfusionMatrix.Contingency |
getContingency(U positiveLabel)
Returns the contingency table for the given class label, where all other
class labels are treated as negative.
|
void |
gui()
Show the confusion matrix in a GUI.
|
static void |
main(java.lang.String[] args) |
java.lang.String |
printTable()
Prints the current confusion in table form to a string, with contingency
|
void |
setDelimPadSize(int newPadSize)
Sets the width used to separate cells in the table.
|
void |
setLeftPadSize(int newPadSize)
This sets the lefthand side pad width for displaying the text table.
|
void |
setUseRealLabels(boolean useRealLabels) |
java.lang.String |
toString() |
java.util.Set<U> |
uniqueLabels()
Returns the set of distinct class labels
entered into this confusion table.
|
public ConfusionMatrix()
public ConfusionMatrix(java.util.Locale locale)
public java.lang.String toString()
toString
in class java.lang.Object
public void setLeftPadSize(int newPadSize)
newPadSize
- public void setDelimPadSize(int newPadSize)
public void setUseRealLabels(boolean useRealLabels)
public void add(U guess, U gold, int increment)
public java.lang.Integer get(U guess, U gold)
public java.util.Set<U> uniqueLabels()
public ConfusionMatrix.Contingency getContingency(U positiveLabel)
public java.lang.String printTable()
public void gui()
public static void main(java.lang.String[] args)