|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.nite.datainspection.calc.CoincidenceMatrix
public class CoincidenceMatrix
CoincidenceMatrix has methods for comparing Two Classifications. Both classifications must contain exactly the same items in the same order.
The coincidence matrix accounts for Values (labels)
coincidence_matrix[Val1][Val2] is the number of times that one classification labeled some item Val1 the other Val2
coincidence_matrix is symmetrical along the main-diagonal.
the total over all entry numbers is 2*N, where N is the number of items judged (2*N values are given).
This class contains a method for computing kappa (a type of distance measure between classifications)
This distance uses a distance metric on the type of Values(class labels) assigned to the items(units).
Usually the Boolean Metric is used: distance = 0 iff values are equal otherwise it is 1.
If you think that some labels are more equal than others you may use a weighted kappa, that uses your
own DistanceMetric
kappaKrippendorf - returns the same value as alphaNominal with the standard BooleanMetric.
alphaNominal(DistanceMetric) - according to Krippendorff - requires a DistanceMetric defined on the values of the classification
kappaCohen is computed using the confusion matrix (this kappa may differ from kappa Krippendorff)
The implementation is based on "Computing Krippendorff's Alpha-Reliability"
Classification
,
DistanceMetric
Constructor Summary | |
---|---|
CoincidenceMatrix(Classification f,
Classification s)
|
|
CoincidenceMatrix(ConfusionMatrix conf_m)
|
|
CoincidenceMatrix(int size)
creates an empty coincidence matrix of given size with default values the numbers (0,1,...,size-1) |
Method Summary | |
---|---|
double |
alphaNominal(DistanceMetric dist)
computes alpha for nominal values using the given distance metric the distance metric should be appropriate for the Values that occur in the Classification for which this CoincidenceMatrix is computed at contruction |
double |
entry(int row,
int col)
|
double |
entry(Value rowValue,
Value colValue)
|
java.util.List |
getValues()
|
double |
kappaKrippendorff()
returns the same value as alpha when using the standard Boolean Metric. |
static void |
main(java.lang.String[] args)
|
int |
nrOfItems()
|
int |
numberOfValues()
|
void |
printMatrix(java.io.PrintWriter pw)
|
void |
printMatrix(java.lang.String filename)
|
void |
printValues(java.io.PrintWriter pw)
print all Values that occur in first or second on SO |
void |
setDistanceMetrics(DistanceMetric dist)
set the distance metric used |
void |
setEntry(int row,
int col,
double cv)
|
void |
setEntry(Value rowValue,
Value colValue,
double cv)
set coinm[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 |
showDistanceMatrix(java.lang.String outFile)
|
void |
showMatrix()
|
void |
showValues()
print all Values that occur in first or second on SO |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CoincidenceMatrix(Classification f, Classification s)
f
- the first Classifications
- the second Classification
required: f and s are classifications of the same ordered list of items/units classified
the constructor computes the coincidence matrixpublic CoincidenceMatrix(int size)
public CoincidenceMatrix(ConfusionMatrix conf_m)
conf_m
- the confusion matrix from which this coincidence matrix is computed (CoinMatrix = ConfMatrix + ConfMatrix^T)Method Detail |
---|
public void setValues(java.util.List vals)
public double entry(int row, int col)
public double entry(Value rowValue, Value colValue)
public void setEntry(Value rowValue, Value colValue, double cv)
public void setEntry(int row, int col, double cv)
public java.util.List getValues()
public void showMatrix()
public void printMatrix(java.lang.String filename)
public void printMatrix(java.io.PrintWriter pw)
public void showValues()
public void printValues(java.io.PrintWriter pw)
public int numberOfValues()
public int nrOfItems()
public double alphaNominal(DistanceMetric dist)
public double kappaKrippendorff()
public void setDistanceMetrics(DistanceMetric dist)
public void showDistanceMatrix(java.lang.String outFile)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |