---
title: "init(predicted:groundTruth:labels:)"
framework: createmlcomponents
role: symbol
role_heading: Initializer
path: "createmlcomponents/classificationmetrics/init(predicted:groundtruth:labels:)"
---

# init(predicted:groundTruth:labels:)

Creates classification metrics for predicted and ground truth labels.

## Declaration

```swift
init<Predicted, Correct>(predicted: Predicted, groundTruth: Correct, labels: Set<Label>) where Label == Predicted.Element, Predicted : Sequence, Correct : Sequence, Predicted.Element == Correct.Element
```

## Discussion

Discussion The predicted and ground truth collections are matched element by element in the order they are provided. Both collections must have the same number of elements. Labels not in the labels set are ignored. Parameters predicted: The predicted labels. groundTruth: The true labels. labels: The set of labels to consider.

## See Also

### Creating the distribution

- [init(_:_:)](createmlcomponents/classificationmetrics/init(_:_:).md)
- [init()](createmlcomponents/classificationmetrics/init().md)
- [init(_:)](createmlcomponents/classificationmetrics/init(_:).md)
- [init(_:labels:)](createmlcomponents/classificationmetrics/init(_:labels:).md)
