<!--
{
  "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/MultiLabelClassificationMetrics",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents31MultiLabelClassificationMetricsV"
  },
  "title" : "MultiLabelClassificationMetrics"
}
-->

# MultiLabelClassificationMetrics

Multi-label classification metrics.

```
struct MultiLabelClassificationMetrics<Label> where Label : Hashable
```

## Topics

### Creating the distribution

[`init(some Sequence<(classification: ClassificationDistribution<Label>, labels: Set<Label>)>, strategy: MultiLabelClassificationMetrics<Label>.ThresholdSelectionStrategy) throws`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/init(_:strategy:))

Creates multi-label classification metrics for classifications and ground truth labels.

[`init(some Sequence<(classification: ClassificationDistribution<Label>, labels: Set<Label>)>, strategy: MultiLabelClassificationMetrics<Label>.ThresholdSelectionStrategy, labels: Set<Label>) throws`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/init(_:strategy:labels:))

Creates multi-label classification metrics for classifications and ground truth labels.

[`init(classifications: some Sequence<ClassificationDistribution<Label>>, groundTruth: some Sequence<Set<Label>>, strategy: MultiLabelClassificationMetrics<Label>.ThresholdSelectionStrategy) throws`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/init(classifications:groundTruth:strategy:))

Creates multi-label classification metrics for classifications and ground truth labels.

[`init(classifications: some Sequence<ClassificationDistribution<Label>>, groundTruth: some Sequence<Set<Label>>, strategy: MultiLabelClassificationMetrics<Label>.ThresholdSelectionStrategy, labels: Set<Label>) throws`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/init(classifications:groundTruth:strategy:labels:))

Creates multi-label classification metrics for classifications and ground truth labels.

[`init(confidenceThresholds: [Label : Float])`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/init(confidenceThresholds:))

Creates empty multi-label classification metrics.

[`enum ThresholdSelectionStrategy`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/ThresholdSelectionStrategy)

A strategy for selecting a confidence threshold.

### Getting the properties

[`var confidenceThresholds: [Label : Float]`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/confidenceThresholds)

A dictionary of label and confidence thresholds.

[`var exampleCount: Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/exampleCount)

The number of examples used to compute the metrics.

[`var labels: Set<Label>`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/labels)

The classifier labels.

[`var meanAveragePrecision: Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/meanAveragePrecision)

The mean average precision.

### Computing and scoring

[`func count(of: Label) -> Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/count(of:))

Returns the number of times a label appeared in the ground truth collection.

[`func f1Score(for: Label) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/f1Score(for:))

Computes the F1 score from predicted and ground truth values.

[`func falseNegativeCount(of: Label) -> Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/falseNegativeCount(of:))

Returns the number of times a true label was not predicted.

[`func falsePositiveCount(of: Label) -> Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/falsePositiveCount(of:))

Returns the number of times the predicted label did not match the true label.

[`func precisionScore(for: Label) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/precisionScore(for:))

Computes the precision score for a class label.

[`func recallScore(for: Label) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/recallScore(for:))

Computes the recall score for a class label.

[`func trueNegativeCount(of: Label) -> Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/trueNegativeCount(of:))

Returns the number of times a label was not in the predicted or ground truth collections.

[`func truePositiveCount(of: Label) -> Int`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/truePositiveCount(of:))

Returns the number of times the predicted label matched the true label.

### Updating the metrics

[`func add(some Sequence<(classification: ClassificationDistribution<Label>, labels: Set<Label>)>)`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/add(_:))

Updates the metrics with more pairs of classifications and ground truth labels.

[`func add(classifications: some Sequence<ClassificationDistribution<Label>>, groundTruth: some Sequence<Set<Label>>)`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/add(classifications:groundTruth:))

Updates the metrics with more classifications and ground truth labels.

### Computing the precision

[`static func meanAveragePrecisionScore(some Sequence<(classification: ClassificationDistribution<Label>, labels: Set<Label>)>) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/meanAveragePrecisionScore(_:))

Computes the mean average precision.

[`static func meanAveragePrecisionScore(some Sequence<(classification: ClassificationDistribution<Label>, labels: Set<Label>)>, labels: Set<Label>) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/meanAveragePrecisionScore(_:labels:))

Computes the mean average precision.

[`static func meanAveragePrecisionScore(classifications: some Sequence<ClassificationDistribution<Label>>, groundTruth: some Sequence<Set<Label>>) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/meanAveragePrecisionScore(classifications:groundTruth:))

Computes the mean average precision.

[`static func meanAveragePrecisionScore(classifications: some Sequence<ClassificationDistribution<Label>>, groundTruth: some Sequence<Set<Label>>, labels: Set<Label>) -> Float`](/documentation/CreateMLComponents/MultiLabelClassificationMetrics/meanAveragePrecisionScore(classifications:groundTruth:labels:))

Computes the mean average precision.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)