T - the type of tokens contained in the unit and its associated
multi-word expressions.S - the type of sentence whose results are stored. Is parameterized by
tokens of type T.public class MWEResult<T extends IToken,S extends IMarkedSentence<T>> extends java.lang.Object implements IOverallResult<T,S>
IOverallResult interface. Contains the
overall precision and recall scores with and without partial credit. All of
the data stored in this result is organized by part of speech.| Constructor and Description |
|---|
MWEResult(java.util.Map<MWEPOS,java.lang.Integer> answer,
java.util.Map<MWEPOS,java.lang.Integer> found,
java.util.Map<MWEPOS,java.lang.Integer> correct,
java.util.Map<MWEPOS,java.lang.Double> partial,
java.util.Map<java.lang.String,ISentenceResult<T,S>> detailed)
Constructs the result from the answer, found and correct data, and the
precision, recall and partial credit scores.
|
| Modifier and Type | Method and Description |
|---|---|
static double |
calcF1Score(double precision,
double recall)
Calculates the f1 score.
|
protected double |
calcPartialPrecision(MWEPOS pos)
Calculates the precision over the specified part of speech, taking into
account partial credit for the specified MWE part of speech.
|
protected double |
calcPartialRecall(MWEPOS pos)
Calculates the recall over the specified part of speech, taking into
account partial credit for the specified MWE part of speech.
|
static double |
calcPrecision(double correctlyRetrieved,
double totalRetrieved)
Given the total number of MWEs retrieved and the number of MWEs that are
correct, calculates precision.
|
protected double |
calcPrecision(MWEPOS pos)
Calculates the precision over the specified parts of speech, or all parts of
speech if the specified part of speech is
null |
static double |
calcRecall(double correctlyRetrieved,
double totalAnswers)
Given the total number of answer MWEs and the number of MWEs that are
correct, calculates recall.
|
protected double |
calcRecall(MWEPOS pos)
Calculates the recall over the specified parts of speech, or all parts of
speech if the specified part of speech is
null |
java.util.Map<MWEPOS,java.lang.Integer> |
getAnswerData()
Returns a map that stores the number of answer multi-word expressions for
each part of speech.
|
java.util.Map<MWEPOS,java.lang.Integer> |
getCorrectData()
Returns a map that stores the number of multi-word expressions correctly
found by the detector for each part of speech.
|
java.util.Map<java.lang.String,ISentenceResult<T,S>> |
getDetails()
Returns a map that stores the results for a unit under its ID.
|
java.util.Map<MWEPOS,java.lang.Double> |
getF1Scores()
Returns a map that stores the f1 measures of the detector for each part
of speech.
|
java.util.Map<MWEPOS,java.lang.Integer> |
getFoundData()
Returns a map that stores the number of multi-word expressions found by
the detector for each part of speech.
|
double |
getFScore()
Returns the F1 score, a double between zero and 1, inclusive.
|
double |
getPartialF1Score()
Returns the total F score earned by the detector, taking into account
partial credit.
|
java.util.Map<MWEPOS,java.lang.Double> |
getPartialF1Scores()
Returns a map that stores the f1 measure of the detector for each part of
speech after adding the partial credit to its correct score.
|
double |
getPartialPrecision()
Returns the total precision of the detector after counting partial
credit.
|
java.util.Map<MWEPOS,java.lang.Double> |
getPartialPrecisionScores()
Returns a map that stores the precision of the detector for each part of
speech after adding the partial credit to its correct score.
|
double |
getPartialRecall()
Returns the total recall of the detector after counting partial credit.
|
java.util.Map<MWEPOS,java.lang.Double> |
getPartialRecallScores()
Returns a map that stores the recall of the detector for
each part of speech after adding the partial credit to its correct score.
|
double |
getPartialScore()
Returns the total partial credit earned by the detector.
|
java.util.Map<MWEPOS,java.lang.Double> |
getPartialScores()
Returns a map that stores the partial credit for the partially correct
multi-word expressions found by the detector for each part of speech.
|
double |
getPrecision()
Returns the precision, a double between zero and 1, inclusive.
|
java.util.Map<MWEPOS,java.lang.Double> |
getPrecisionScores()
Returns a map that stores the precision of the detector for
each part of speech.
|
double |
getRecall()
Returns the recall, a double between zero and 1, inclusive.
|
java.util.Map<MWEPOS,java.lang.Double> |
getRecallScores()
Returns a map that stores the recall of the detector for each part of
speech.
|
int |
getTotalAnswers()
Returns the total number of answers.
|
int |
getTotalCorrect()
Returns the total number of items correctly identified.
|
int |
getTotalFound()
Returns the total number items found.
|
static double |
sumDbl(java.lang.Iterable<? extends java.lang.Double> m)
Return the sum of all the values stored in the map.
|
static int |
sumInt(java.lang.Iterable<? extends java.lang.Integer> m)
Return the sum of all the values stored in the map.
|
java.lang.String |
toString() |
static java.lang.String |
toString(IOverallResult<?,?> result)
Creates a table displaying the number of answer, found and correct
multi-word expressions and the precision, recall and partial credit
scores of the detector for each part of speech.
|
public MWEResult(java.util.Map<MWEPOS,java.lang.Integer> answer, java.util.Map<MWEPOS,java.lang.Integer> found, java.util.Map<MWEPOS,java.lang.Integer> correct, java.util.Map<MWEPOS,java.lang.Double> partial, java.util.Map<java.lang.String,ISentenceResult<T,S>> detailed)
ISentenceResult objects for a unit under its ID.answer - a map that stores the number of answer multi-word expressions
for each part of speech.found - a map that stores the number of multi-word expressions found
by the detector for each part of speech.correct - a map that stores the number of multi-word expressions
correctly found by the detector for each part of speech.partial - a map that stores the partial credit for the partially correct
multi-word expressions found by the detector for each part of
speech.detailed - a map that stores the results for a unit under its ID.public double getPrecision()
IBaseResultgetPrecision in interface IBaseResultpublic double getRecall()
IBaseResultgetRecall in interface IBaseResultpublic java.util.Map<MWEPOS,java.lang.Double> getPrecisionScores()
IOverallResultnull.getPrecisionScores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getRecallScores()
IOverallResultnull.getRecallScores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getF1Scores()
IOverallResultnull.getF1Scores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public int getTotalAnswers()
IBaseResultgetTotalAnswers in interface IBaseResultpublic int getTotalCorrect()
IBaseResultgetTotalCorrect in interface IBaseResultpublic int getTotalFound()
IBaseResultgetTotalFound in interface IBaseResultpublic java.util.Map<MWEPOS,java.lang.Integer> getAnswerData()
IOverallResultnull.getAnswerData in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Integer> getFoundData()
IOverallResultnull.getFoundData in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Integer> getCorrectData()
IOverallResultnull.getCorrectData in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public double getPartialPrecision()
IOverallResultgetPartialPrecision in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public double getPartialRecall()
IOverallResultgetPartialRecall in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getPartialScores()
IOverallResultnull.getPartialScores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getPartialPrecisionScores()
IOverallResultnull.getPartialPrecisionScores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getPartialRecallScores()
IOverallResultnull.getPartialRecallScores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<MWEPOS,java.lang.Double> getPartialF1Scores()
IOverallResultnull.getPartialF1Scores in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public double getPartialScore()
IOverallResultgetPartialScore in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public double getFScore()
IBaseResultgetFScore in interface IBaseResultpublic double getPartialF1Score()
IOverallResultgetPartialF1Score in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.Map<java.lang.String,ISentenceResult<T,S>> getDetails()
IOverallResultnull.getDetails in interface IOverallResult<T extends IToken,S extends IMarkedSentence<T>>public java.lang.String toString()
toString in class java.lang.Objectprotected double calcPrecision(MWEPOS pos)
nullpos - the part of speech over which the precision is to be calculated;
null means all parts of speechprotected double calcRecall(MWEPOS pos)
nullpos - the part of speech over which the recall is to be calculated;
null means all parts of speechprotected double calcPartialPrecision(MWEPOS pos)
pos - the MWE pos for which the precision should be calculated; or
null if for allprotected double calcPartialRecall(MWEPOS pos)
pos - the MWE pos for which the recall should be calculated; or
null if for allpublic static java.lang.String toString(IOverallResult<?,?> result)
result - a non-null IResultpublic static double calcPrecision(double correctlyRetrieved,
double totalRetrieved)
Double.NaN if the
number of correct MWEs is greater than 0 and there are no found MWEs,
since this is undefined. Will return 1.0, a perfect score, if both the
number of found MWEs and correct MWEs are 0 or if both numbers are equal.correctlyRetrieved - the number of MWEs that are correctly identifiedtotalRetrieved - the number of MWEs retrievedDouble.NaN if the number of
correct MWEs is greater than 0 and there are no found MWEs. Will
return 1.0, a perfect score, if both the number of found MWEs and
correct MWEs are 0 or if both numbers are equal.public static double calcRecall(double correctlyRetrieved,
double totalAnswers)
Double.NaN if the number
of correct MWEs is greater than 0 and there are no answer MWEs,
since this is undefined. Will return 1.0, a perfect score, if both the
number of answer MWEs and correct MWEs are 0 or if both numbers are
equal.correctlyRetrieved - the number of MWEs that are correctly identifiedtotalAnswers - the total number of answer MWEsDouble.NaN if the number of
correct MWEs is greater than 0 and there are no answer MWEs.
Will return 1.0, a perfect score, if both the number of answer
MWEs and correct MWEs are 0 or if both numbers are equal.public static double calcF1Score(double precision,
double recall)
Double.NaN.precision - the precision. Must be a non-negative double less than 1.0.recall - the recall. Must be a non-negative double less than 1.0.Double.NaN if either the
precision or recall is undefined; otherwise, will be a
nonnegative double between 0.0 and 1.0.public static int sumInt(java.lang.Iterable<? extends java.lang.Integer> m)
m - the map whose values are to be summedpublic static double sumDbl(java.lang.Iterable<? extends java.lang.Double> m)
m - the map whose values are to be summedCopyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.