---
title: "mapLabels(_:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/classificationmetrics/maplabels(_:)"
---

# mapLabels(_:)

Returns new classification metrics where the labels are the result of applying a transformation.

## Declaration

```swift
func mapLabels<T>(_ transform: (Label) throws -> T) rethrows -> ClassificationMetrics<T> where T : Hashable
```

## Discussion

Discussion The transformation can combine separate labels into one. The metrics will be adjusted accordingly by combining counts from the original labels. An example of this is combining mixed cased labels into lowercase: let metrics = ClassificationMetrics(predicted, groundTruth).map({ $0.lowercased() })

## See Also

### Computing and scoring

- [makeConfusionMatrix()](createmlcomponents/classificationmetrics/makeconfusionmatrix().md)
- [precisionScore(label:)](createmlcomponents/classificationmetrics/precisionscore(label:).md)
- [recallScore(label:)](createmlcomponents/classificationmetrics/recallscore(label:).md)
- [count(label:)](createmlcomponents/classificationmetrics/count(label:).md)
- [count(predicted:)](createmlcomponents/classificationmetrics/count(predicted:).md)
- [count(predicted:label:)](createmlcomponents/classificationmetrics/count(predicted:label:).md)
- [trueNegativeCount(of:)](createmlcomponents/classificationmetrics/truenegativecount(of:).md)
- [truePositiveCount(of:)](createmlcomponents/classificationmetrics/truepositivecount(of:).md)
- [falseNegativeCount(of:)](createmlcomponents/classificationmetrics/falsenegativecount(of:).md)
- [falsePositiveCount(of:)](createmlcomponents/classificationmetrics/falsepositivecount(of:).md)
- [f1Score(label:)](createmlcomponents/classificationmetrics/f1score(label:).md)
