|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nite.datainspection.calc.ConfusionMatrix
public class ConfusionMatrix
This class ConfusionMatrix has methods for comparing Two Classifications. Both classifications must contain exactly the same items in the same order.
encapsulates a square matrix of double with row and column names.
Rows and Column names are unique Values that occur in the ordered list of values
confusion matrix contains double entries for each pair of Values in the ordered list of class labels (Values)
confusion(rowValue,colValue) = the (weighted) count of times that rowValue was confused with colValue
a confusion matrix is not nec. symmetrical.
kappaCohen - according to Cohen(1966) - see: Di Eugenio in: Comput. Ling. 2004, Vol.30, nr.1
Classification
Constructor Summary | |
---|---|
ConfusionMatrix(Classification f,
Classification s)
construct a confusion matrix from the given Classifications condition: f and s are equally long and agree on items that have been classified. |
|
ConfusionMatrix(double[][] matrix)
create Confusion Matrix with the given matrix as entries the ordered list of values (class labels) is : 0,1,2,...,matrix.length-1 |
|
ConfusionMatrix(double[][] matrix,
java.util.List vals)
create Confusion Matrix with the given matrix as entries and the given list as class labels assumes ordering of labels in list and matrix columns and rows are equal. |
|
ConfusionMatrix(int size)
creates an empty confusion matrix of given size with default values the numbers (0,1,...,size-1) |
|
ConfusionMatrix(java.util.List values)
|
Method Summary | |
---|---|
void |
add(Value rowValue,
Value colValue)
|
double |
entry(int row,
int col)
|
double |
entry(Value rowValue,
Value colValue)
|
Value |
getValue(int n)
|
java.util.List |
getValues()
|
double |
kappa()
kappa is computed using the confusion matrix method: Cohen - see also Di Eugenio and Glass in Comput. |
static void |
main(java.lang.String[] args)
|
int |
numberOfValues()
|
void |
printMatrix(java.io.PrintWriter pw)
|
void |
printMatrix(java.lang.String filename)
|
void |
printValues(java.io.PrintWriter pw)
print all Values in list values on given PrintWriter |
static ConfusionMatrix |
readCSVFile(java.io.BufferedReader reader,
int counter)
create and return a ConfusionMatrix from the data in a CSV file format: labelName1;x;x;x;x;x;x labelName2;x;x;x;x;x;x ... |
void |
setEntry(int row,
int col,
double cv)
|
void |
setEntry(Value rowValue,
Value colValue,
double cv)
set confusion[rowValue][colValue] to cv |
void |
setValues(java.util.List vals)
set the list of class labels used the order should be the same as the order of Values in the row and columns of the matrix |
void |
showValues()
print all Values that occur in first or second on SO |
int |
size()
size() equals numberOfValues() |
java.lang.String |
toString()
|
double |
totalColumn(int i)
|
double |
totalItems()
|
double |
totalRow(int i)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConfusionMatrix(Classification f, Classification s)
public ConfusionMatrix(double[][] matrix)
public ConfusionMatrix(double[][] matrix, java.util.List vals)
matrix
- the entries of the confusion matrixvalues
- the ordered list of class labelspublic ConfusionMatrix(int size)
public ConfusionMatrix(java.util.List values)
Method Detail |
---|
public double entry(int row, int col)
public double entry(Value rowValue, Value colValue)
public void setValues(java.util.List vals)
public void setEntry(Value rowValue, Value colValue, double cv)
public void setEntry(int row, int col, double cv)
public void add(Value rowValue, Value colValue)
public int numberOfValues()
public java.util.List getValues()
public Value getValue(int n)
public void printMatrix(java.lang.String filename)
public java.lang.String toString()
toString
in class java.lang.Object
public void printMatrix(java.io.PrintWriter pw)
public void showValues()
public void printValues(java.io.PrintWriter pw)
public static ConfusionMatrix readCSVFile(java.io.BufferedReader reader, int counter)
reader
- counter
- the number of data columns (size of matrix)public double kappa()
public double totalItems()
public double totalColumn(int i)
public double totalRow(int i)
public int size()
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |