---
title: "averagePrecision(predictions:annotations:confidenceThresholds:overlapThreshold:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/objectdetectionmetrics/averageprecision(predictions:annotations:confidencethresholds:overlapthreshold:)"
---

# averagePrecision(predictions:annotations:confidenceThresholds:overlapThreshold:)

Calculates average precision for all the labels at the bounding box overlap threshold.

## Declaration

```swift
func averagePrecision<Scalar>(predictions: [[DetectedObject<Label>]], annotations: [ObjectDetectionAnnotation<Label>], confidenceThresholds: [Label : Float] = [:], overlapThreshold: Double = 0.5) -> [Label : Scalar] where Scalar : BinaryFloatingPoint
```

## Parameters

- `predictions`: A list of all the predictions from an object detection model. Each element in the list is a list of predictions from one image.
- `annotations`: A list of all the annotations. Each element is an ObjectDetectionAnnotation object from one image.
- `confidenceThresholds`: Probability thresholds for each label. The values will always be between 0.0 and 1.0. If any label does not have a threshold, the defaultConfidenceThreshold is used for that label. The default value is [:].
- `overlapThreshold`: The overlap threshold for the bounding boxes. The value will always be between 0.0 and 1.0. The default value is 0.5

## Return Value

Return Value Average precision for all the labels at the overlap threshold.

## See Also

### Calculating the precision

- [averageOfAveragePrecisionAtVariedThresholds(predictions:annotations:confidenceThresholds:)](createmlcomponents/objectdetectionmetrics/averageofaverageprecisionatvariedthresholds(predictions:annotations:confidencethresholds:).md)
- [averageOfMeanAveragePrecisionAtVariedThresholds(predictions:annotations:confidenceThresholds:)](createmlcomponents/objectdetectionmetrics/averageofmeanaverageprecisionatvariedthresholds(predictions:annotations:confidencethresholds:).md)
- [meanAveragePrecision(predictions:annotations:confidenceThresholds:overlapThreshold:)](createmlcomponents/objectdetectionmetrics/meanaverageprecision(predictions:annotations:confidencethresholds:overlapthreshold:).md)
