Package opennlp.tools.util.eval
Class FMeasure
java.lang.Object
opennlp.tools.util.eval.FMeasure
The 
FMeasure is a utility class for evaluators
 which measures precision, recall and the resulting f-measure.
 Evaluation results are the arithmetic mean of the precision scores calculated for each reference sample and the arithmetic mean of the recall scores calculated for each reference sample.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptiondoublef-measure = 2 * precision * recall / (precision + recall).doubledoublevoidMerge results intometric.static doubleCalculates the precision score for the given reference and predicted spans.static doubleCalculates the recall score for the given reference and predicted spans.toString()voidupdateScores(Object[] references, Object[] predictions) Updates the score based on the number of true positives and the number of predictions and references.
- 
Constructor Details- 
FMeasurepublic FMeasure()
 
- 
- 
Method Details- 
getPrecisionScorepublic double getPrecisionScore()- Returns:
- Retrieves the arithmetic mean of the precision scores calculated for each evaluated sample.
 
- 
getRecallScorepublic double getRecallScore()- Returns:
- Retrieves the arithmetic mean of the recall score calculated for each evaluated sample.
 
- 
getFMeasurepublic double getFMeasure()f-measure = 2 * precision * recall / (precision + recall).- Returns:
- Retrieves the f-measure or -1if precision + recall<= 0
 
- 
updateScoresUpdates the score based on the number of true positives and the number of predictions and references.- Parameters:
- references- the provided references
- predictions- the predicted spans
 
- 
mergeIntoMerge results intometric.- Parameters:
- measure- The- FMeasureto merge.
 
- 
toString
- 
precisionCalculates the precision score for the given reference and predicted spans.- Parameters:
- references- The gold standard spans.
- predictions- The predicted spans.
- Returns:
- The precision score or NaNif there are no predicted spans.
 
- 
recallCalculates the recall score for the given reference and predicted spans.- Parameters:
- references- The gold standard spans
- predictions- The predicted spans
- Returns:
- The recall score or NaNif there are no reference spans.
 
 
-