|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgate.util.ClassificationMeasures
public class ClassificationMeasures
Given two annotation sets, a type and a feature, compares the feature values. It finds matching annotations and treats the feature values as classifications. Its purpose is to calculate the extent of agreement between the feature values in the two annotation sets. It computes observed agreement and Kappa measures.
| Field Summary | |
|---|---|
private float[][] |
confusionMatrix
Array of dimensions categories * categories. |
private TreeSet<String> |
featureValues
List of feature values that are the labels of the confusion matrix |
private boolean |
isCalculatedKappas
|
private float |
kappaCohen
Cohen's kappa. |
private float |
kappaPi
Scott's pi or Siegel & Castellan's kappa |
| Constructor Summary | |
|---|---|
ClassificationMeasures()
|
|
ClassificationMeasures(Collection<ClassificationMeasures> tables)
Given a list of ClassificationMeasures, this will combine to make a megatable. |
|
| Method Summary | |
|---|---|
void |
calculateConfusionMatrix(AnnotationSet aS1,
AnnotationSet aS2,
String type,
String feature,
boolean verbose)
Create a confusion matrix in which annotations of identical span bearing the specified feature name are compared in terms of feature value. |
protected void |
computeKappaPairwise()
Compute Cohen's and Pi kappas for two annotators. |
private float[][] |
convert2DHashTo2DFloatArray(HashMap<String,HashMap<String,Float>> countMap,
TreeSet<String> featureValues)
Convert between two formats of confusion matrix. |
float |
getAgreedTrials()
Gets the number of annotations for which the two annotation sets are in agreement with regards to the annotation type. |
float[][] |
getConfusionMatrix()
To understand exactly which types are being confused with which other types you will need to view this array in conjunction with featureValues, which gives the class labels (annotation types) in the correct order. |
List<List<String>> |
getConfusionMatrix(String title)
|
SortedSet<String> |
getFeatureValues()
This is necessary to make sense of the confusion matrix. |
float |
getKappaCohen()
Kappa is defined as the observed agreements minus the agreement expected by chance. |
float |
getKappaPi()
Kappa is defined as the observed agreements minus the agreement expected by chance. |
List<String> |
getMeasuresRow(Object[] measures,
String documentName)
|
float |
getObservedAgreement()
Portion of the instances on which the annotators agree. |
float |
getTotalTrials()
Gets the total number of annotations in the two sets. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private float[][] confusionMatrix
private float kappaCohen
private float kappaPi
private boolean isCalculatedKappas
private TreeSet<String> featureValues
| Constructor Detail |
|---|
public ClassificationMeasures()
public ClassificationMeasures(Collection<ClassificationMeasures> tables)
tables - tables to combine| Method Detail |
|---|
public float getObservedAgreement()
public float getKappaCohen()
public float getKappaPi()
public float[][] getConfusionMatrix()
public SortedSet<String> getFeatureValues()
public void calculateConfusionMatrix(AnnotationSet aS1,
AnnotationSet aS2,
String type,
String feature,
boolean verbose)
aS1 - annotation set to compare to the secondaS2 - annotation set to compare to the firsttype - annotation type containing the features to comparefeature - feature name whose values will be comparedverbose - message error output when ignoring annotationsprotected void computeKappaPairwise()
public float getAgreedTrials()
public float getTotalTrials()
public List<List<String>> getConfusionMatrix(String title)
title - matrix title
public List<String> getMeasuresRow(Object[] measures,
String documentName)
private float[][] convert2DHashTo2DFloatArray(HashMap<String,HashMap<String,Float>> countMap,
TreeSet<String> featureValues)
countMap - count for each label as in confusion matrixfeatureValues - sorted set of labels that will define the dimensions
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||