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

# init(_:_:)

Creates classification metrics for predicted and ground truth labels.

```
init<Predicted, Correct>(_ predicted: Predicted, _ groundTruth: Correct) where Label == Predicted.Element, Predicted : Collection, Correct : Collection, 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.

- Parameters
  - predicted: The predicted labels.
  - groundTruth: The true labels.

---

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)