<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/ClassificationMetrics/init(predicted:groundTruth:labels:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents21ClassificationMetricsV9predicted11groundTruth6labelsACyxGqd___qd_0_ShyxGtc7ElementQyd__RszSTRd__STRd_0_AIQyd_0_AJRSr0_lufc"
  },
  "title" : "init(predicted:groundTruth:labels:)"
}
-->

# init(predicted:groundTruth:labels:)

Creates classification metrics for predicted and ground truth labels.

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

## 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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)