public class FMeasure extends java.lang.Object implements ClassificationMeasure
The traditional or balanced F-score (F1 score) is the harmonic mean of precision and recall, where an F1 score reaches its best value at 1 and worst at 0.
The general formula involves a positive real β so that F-score measures the effectiveness of retrieval with respect to a user who attaches β times as much importance to recall as precision.
| Constructor and Description |
|---|
FMeasure()
Constructor of F1 score.
|
FMeasure(double beta)
Constructor of general F-score.
|
| Modifier and Type | Method and Description |
|---|---|
double |
measure(int[] truth,
int[] prediction)
Returns an index to measure the quality of classification.
|
static double |
of(double beta,
int[] truth,
int[] prediction)
Calculates the F1 score.
|
public FMeasure()
public FMeasure(double beta)
beta - a positive value such that F-score measures
the effectiveness of retrieval with respect
to a user who attaches β times as much
importance to recall as precision.public double measure(int[] truth,
int[] prediction)
ClassificationMeasuremeasure in interface ClassificationMeasuretruth - the true class labels.prediction - the predicted class labels.public static double of(double beta,
int[] truth,
int[] prediction)
beta - a positive value such that F-score measures
the effectiveness of retrieval with respect
to a user who attaches β times as much
importance to recall as precision.