---
title: makeConfusionMatrix()
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: createmlcomponents/classificationmetrics/makeconfusionmatrix()
---

# makeConfusionMatrix()

Computes the confusion matrix.

## Declaration

```swift
func makeConfusionMatrix() -> MLShapedArray<Float> where Label : Comparable, Label : Decodable, Label : Encodable
```

## Discussion

Discussion The ith row and jth column value indicate the count of true label being the ith class and predicted label being the jth class. The labels are sorted in ascending order.

## See Also

### Computing and scoring

- [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)
- [mapLabels(_:)](createmlcomponents/classificationmetrics/maplabels(_:).md)
