public class AnnotationStatisticsCompact<OUTCOME_TYPE extends Comparable<? super OUTCOME_TYPE>> extends Object implements Serializable
Annotation
s extracted by a system to gold
Annotation
s.
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 org.apache.uima.jcas.tcas.Annotation> |
add(Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
Collection<? extends ANNOTATION_TYPE> predictedAnnotations)
Update the statistics, comparing the reference annotations to the predicted annotations.
|
<ANNOTATION_TYPE,SPAN_TYPE> |
add(Collection<? extends ANNOTATION_TYPE> referenceAnnotations,
Collection<? extends ANNOTATION_TYPE> predictedAnnotations,
com.google.common.base.Function<ANNOTATION_TYPE,SPAN_TYPE> annotationToSpan,
com.google.common.base.Function<ANNOTATION_TYPE,OUTCOME_TYPE> annotationToOutcome)
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 Comparable<? super OUTCOME_TYPE>> |
addAll(Iterable<AnnotationStatisticsCompact<OUTCOME_TYPE>> statistics)
Add all statistics together.
|
static <ANNOTATION_TYPE extends org.apache.uima.jcas.cas.TOP> |
annotationToFeatureValue(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 org.apache.uima.jcas.tcas.Annotation> |
annotationToSpan()
Creates a
Function that converts an Annotation into a hashable representation
of its begin and end offsets. |
org.cleartk.eval.util.ConfusionMatrix<OUTCOME_TYPE> |
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) |
String |
toString() |
String |
toTsv() |
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 org.apache.uima.jcas.tcas.Annotation> com.google.common.base.Function<ANNOTATION_TYPE,org.apache.ctakes.assertion.eval.AnnotationStatisticsCompact.Span> 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 org.apache.uima.jcas.cas.TOP> com.google.common.base.Function<ANNOTATION_TYPE,String> annotationToFeatureValue(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> com.google.common.base.Function<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 Comparable<? super OUTCOME_TYPE>> AnnotationStatisticsCompact<OUTCOME_TYPE> addAll(Iterable<AnnotationStatisticsCompact<OUTCOME_TYPE>> statistics)
Evaluation_ImplBase#crossValidation(List, int)
.statistics
- The sequence of statistics that should be combined.public <ANNOTATION_TYPE extends org.apache.uima.jcas.tcas.Annotation> void add(Collection<? extends ANNOTATION_TYPE> referenceAnnotations, 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(Collection<? extends ANNOTATION_TYPE> referenceAnnotations, Collection<? extends ANNOTATION_TYPE> predictedAnnotations, com.google.common.base.Function<ANNOTATION_TYPE,SPAN_TYPE> annotationToSpan, com.google.common.base.Function<ANNOTATION_TYPE,OUTCOME_TYPE> 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)
public org.cleartk.eval.util.ConfusionMatrix<OUTCOME_TYPE> confusions()
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 String toTsv()
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.