Accuracy Score
EasyMachine LearningArrayMath
Description
Given equal-length arrays yTrue and yPred of class labels, return the accuracy (fraction of positions that match), rounded to 4 decimal places.
Examples
Input:
yTrue = [1,0,1,1], yPred = [1,0,0,1]Output:
0.75Explanation:
Dividing the number of matching labels by the total gives 0.75.
Input:
yTrue = [1,1,1], yPred = [1,1,1]Output:
1Explanation:
Dividing the number of matching labels by the total gives 1.
Input:
yTrue = [0,1], yPred = [1,0]Output:
0Explanation:
Dividing the number of matching labels by the total gives 0.
Constraints
- •
1 ≤ yTrue.length ≤ 10⁴