public class AnnotationStatisticsCompact<OUTCOME_TYPE extends java.lang.Comparable<? super OUTCOME_TYPE>>
extends java.lang.Object
implements java.io.Serializable
Annotation
s extracted by a system to gold
Annotation
s.
Modifier and Type | Class and Description |
---|---|
private static class |
AnnotationStatisticsCompact.Span |
Modifier and Type | Field and Description |
---|---|
private |
confusionMatrix |
private |
correctOutcomes |
private |
predictedOutcomes |
private |
referenceOutcomes |
private static long |
serialVersionUID |
Constructor and Description |
---|
AnnotationStatisticsCompact()
Create an AnnotationStatisticsCompact that compares
Annotation s based on their begin and end
offsets, plus a Feature of the Annotation that represents the outcome or label. |
Modifier and Type | Method and Description |
---|---|
<ANNOTATION_TYPE extends Annotation> |
add(java.util.Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
java.util.Collection<? extends ANNOTATION_TYPE> predictedAnnotations)
Update the statistics, comparing the reference annotations to the predicted annotations.
|
<ANNOTATION_TYPE,SPAN_TYPE> |
add(java.util.Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
java.util.Collection<? extends ANNOTATION_TYPE> predictedAnnotations,
Update the statistics, comparing the reference annotations to the predicted annotations.
|
void |
addAll(AnnotationStatisticsCompact<OUTCOME_TYPE> that)
Adds all the statistics collected by another AnnotationStatisticsCompact to this one.
|
static <OUTCOME_TYPE extends java.lang.Comparable<? super OUTCOME_TYPE>> |
addAll(java.lang.Iterable<AnnotationStatisticsCompact<OUTCOME_TYPE>> statistics)
Add all statistics together.
|
static <ANNOTATION_TYPE extends TOP> |
annotationToFeatureValue(java.lang.String featureName)
Creates a
Function that extracts a feature value from a TOP . |
static <ANNOTATION_TYPE,OUTCOME_TYPE> |
annotationToNull()
Creates a
Function that always returns null. |
static <ANNOTATION_TYPE extends Annotation> |
annotationToSpan()
Creates a
Function that converts an Annotation into a hashable representation
of its begin and end offsets. |
|
confusions()
Returns the
ConfusionMatrix tabulating reference outcomes matched to predicted
outcomes. |
int |
countCorrectOutcomes() |
int |
countCorrectOutcomes(OUTCOME_TYPE outcome) |
int |
countFalseNegatives(OUTCOME_TYPE... positiveOutcomes) |
int |
countFalsePositives(OUTCOME_TYPE... positiveOutcomes) |
int |
countPredictedOutcomes() |
int |
countPredictedOutcomes(OUTCOME_TYPE outcome) |
int |
countReferenceOutcomes() |
int |
countReferenceOutcomes(OUTCOME_TYPE outcome) |
int |
countTrueNegatives(OUTCOME_TYPE... positiveOutcomes) |
int |
countTruePositives(OUTCOME_TYPE... positiveOutcomes) |
double |
f(double beta) |
double |
f(double beta,
OUTCOME_TYPE outcome) |
double |
f1() |
double |
f1(OUTCOME_TYPE outcome) |
double |
precision() |
double |
precision(OUTCOME_TYPE outcome) |
double |
recall() |
double |
recall(OUTCOME_TYPE outcome) |
java.lang.String |
toString() |
java.lang.String |
toTsv() |
private static final long serialVersionUID
privatereferenceOutcomes
privatepredictedOutcomes
privatecorrectOutcomes
privateconfusionMatrix
public AnnotationStatisticsCompact()
Annotation
s based on their begin and end
offsets, plus a Feature
of the Annotation
that represents the outcome or label.public static <ANNOTATION_TYPE extends Annotation>annotationToSpan()
Function
that converts an Annotation
into a hashable representation
of its begin and end offsets.
The Function
created by this method is suitable for passing to the first
Function
argument of #add(Collection, Collection, Function, Function)
.public static <ANNOTATION_TYPE extends TOP>annotationToFeatureValue(java.lang.String featureName)
Function
that extracts a feature value from a TOP
.
The Function
created by this method is suitable for passing to the second
Function
argument of #add(Collection, Collection, Function, Function)
.featureName
- The name of the feature whose value is to be extracted.public static <ANNOTATION_TYPE,OUTCOME_TYPE>annotationToNull()
Function
that always returns null.
This may be useful when only the span of the offset is important, but you still need to pass in
the final argument of #add(Collection, Collection, Function, Function)
.public static <OUTCOME_TYPE extends java.lang.Comparable<? super OUTCOME_TYPE>> AnnotationStatisticsCompact<OUTCOME_TYPE> addAll(java.lang.Iterable<AnnotationStatisticsCompact<OUTCOME_TYPE>> statistics)
Evaluation_ImplBase#crossValidation(List, int)
.statistics
- The sequence of statistics that should be combined.public <ANNOTATION_TYPE extends Annotation> void add(java.util.Collection<? extends ANNOTATION_TYPE> referenceAnnotations, java.util.Collection<? extends ANNOTATION_TYPE> predictedAnnotations)
confusions()
) will be null
.referenceAnnotations
- The reference annotations, typically identified by humans.predictedAnnotations
- The predicted annotations, typically identified by a model.public <ANNOTATION_TYPE,SPAN_TYPE> void add(java.util.Collection<? extends ANNOTATION_TYPE> referenceAnnotations, java.util.Collection<? extends ANNOTATION_TYPE> predictedAnnotations,annotationToSpan, annotationToOutcome)
annotationToSpan
) and if they have the same outcome (according to
annotationToOutcome
).referenceAnnotations
- The reference annotations, typically identified by humans.predictedAnnotations
- The predicted annotations, typically identified by a model.annotationToSpan
- A function that defines how to convert an annotation into a hashable object that
represents the span of that annotation. The annotationToSpan()
method
provides an example function that could be used here.annotationToOutcome
- A function that defines how to convert an annotation into an object that represents
the outcome (or "label") assigned to that annotation. The
annotationToFeatureValue(String)
method provides a sample function that could
be used here.public void addAll(AnnotationStatisticsCompact<OUTCOME_TYPE> that)
that
- The other statistics that should be added to this one.public int countCorrectOutcomes()
public int countCorrectOutcomes(OUTCOME_TYPE outcome)
public int countPredictedOutcomes()
public int countPredictedOutcomes(OUTCOME_TYPE outcome)
public int countReferenceOutcomes()
public int countReferenceOutcomes(OUTCOME_TYPE outcome)
public int countFalseNegatives(OUTCOME_TYPE... positiveOutcomes)
public int countFalsePositives(OUTCOME_TYPE... positiveOutcomes)
public int countTrueNegatives(OUTCOME_TYPE... positiveOutcomes)
public int countTruePositives(OUTCOME_TYPE... positiveOutcomes)
publicconfusions()
ConfusionMatrix
tabulating reference outcomes matched to predicted
outcomes.public double precision()
public double precision(OUTCOME_TYPE outcome)
public double recall()
public double recall(OUTCOME_TYPE outcome)
public double f(double beta)
public double f(double beta, OUTCOME_TYPE outcome)
public double f1()
public double f1(OUTCOME_TYPE outcome)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toTsv()