smile.validation
Class FMeasure
- java.lang.Object
-
- smile.validation.FMeasure
-
- All Implemented Interfaces:
- ClassificationMeasure
public class FMeasure extends java.lang.Object implements ClassificationMeasure
The F-score (or F-measure) considers both the precision and the recall of the test to compute the score. The precision p is the number of correct positive results divided by the number of all positive results, and the recall r is the number of correct positive results divided by the number of positive results that should have been returned. 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 Summary
Constructors Constructor and Description FMeasure()Constructor of F1 score.FMeasure(double beta)Constructor of general F-score.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublemeasure(int[] truth, int[] prediction)Returns an index to measure the quality of classification.
-
-
-
Constructor Detail
-
FMeasure
public FMeasure()
Constructor of F1 score.
-
FMeasure
public FMeasure(double beta)
Constructor of general F-score.- Parameters:
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.
-
-
Method Detail
-
measure
public double measure(int[] truth, int[] prediction)Description copied from interface:ClassificationMeasureReturns an index to measure the quality of classification.- Specified by:
measurein interfaceClassificationMeasure- Parameters:
truth- the true class labels.prediction- the predicted class labels.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG