accuracy()¶
- audmetric.accuracy(truth, prediction, labels=None)[source]¶
Classification accuracy.
- Parameters
truth (
Sequence[object]) – ground truth values/classesprediction (
Sequence[object]) – predicted values/classeslabels (
Sequence[str|int]) – included labels in preferred ordering. Sample is considered in computation if either prediction or ground truth (logical OR) is contained in labels. If no labels are supplied, they will be inferred from and ordered alphabetically.
- Return type
float- Returns
accuracy of prediction
- Raises
ValueError – if
truthandpredictiondiffer in length
Examples
>>> accuracy([0, 0], [0, 1]) 0.5