Package smile.validation.metric
Class Accuracy
java.lang.Object
smile.validation.metric.Accuracy
- All Implemented Interfaces:
Serializable
,ToDoubleBiFunction<int[],
,int[]> ClassificationMetric
The accuracy is the proportion of true results (both true positives and
true negatives) in the population.
- See Also:
-
Field Details
-
instance
Default instance.
-
-
Constructor Details
-
Accuracy
public Accuracy()
-
-
Method Details
-
score
public double score(int[] truth, int[] prediction) Description copied from interface:ClassificationMetric
Returns a score to measure the quality of classification.- Specified by:
score
in interfaceClassificationMetric
- Parameters:
truth
- the true class labels.prediction
- the predicted class labels.- Returns:
- the metric.
-
of
public static double of(int[] truth, int[] prediction) Calculates the classification accuracy.- Parameters:
truth
- the ground truth.prediction
- the prediction.- Returns:
- the metric.
-
toString
-