<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLClassifierMetrics",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML19MLClassifierMetricsV"
  },
  "title" : "MLClassifierMetrics"
}
-->

# MLClassifierMetrics

Metrics you use to evaluate a classifier’s performance.

```
struct MLClassifierMetrics
```

## Overview

Use [`MLClassifierMetrics`](/documentation/CreateML/MLClassifierMetrics) to evaluate your model’s ability to distinguish between different categories when it’s
classifying data.

You can determine the model’s accuracy using the [`classificationError`](/documentation/CreateML/MLClassifierMetrics/classificationError) metric. For
information about how your model is mislabeling or missing a certain category, use the
[`precisionRecall`](/documentation/CreateML/MLClassifierMetrics/precisionRecall) metric. To determine specific cases where your model is mistaking one label
for another, use the [`confusion`](/documentation/CreateML/MLClassifierMetrics/confusion) property.

Accuracy can be a misleading metric if you use unbalanced data, which means the number of examples for some
categories are much larger than others. Instead, use [`precisionRecall`](/documentation/CreateML/MLClassifierMetrics/precisionRecall) or
[`confusion`](/documentation/CreateML/MLClassifierMetrics/confusion).

> Note: Each trained model contains different metrics for its various data sets (training, validation, and testing).
> <doc://com.apple.createml/documentation/CreateML/improving-your-model-s-accuracy> compares these metrics between different data sets.

## Topics

### Understanding the model

[`classificationError`](/documentation/CreateML/MLClassifierMetrics/classificationError)

The fraction of incorrectly labeled examples.

[`precisionRecall`](/documentation/CreateML/MLClassifierMetrics/precisionRecall)

A data table listing the precision and recall percentages for each class.

[`confusion`](/documentation/CreateML/MLClassifierMetrics/confusion)

A table comparing the actual and predicted labels for each classification category.

[`confusionDataFrame`](/documentation/CreateML/MLClassifierMetrics/confusionDataFrame)

A data frame comparing the actual and predicted labels for each class.

[`precisionRecallDataFrame`](/documentation/CreateML/MLClassifierMetrics/precisionRecallDataFrame)

A data frame listing the precision and recall percentages for each class.

### Handling errors

[`isValid`](/documentation/CreateML/MLClassifierMetrics/isValid)

A Boolean value indicating whether the classifier model was able to calculate metrics.

[`error`](/documentation/CreateML/MLClassifierMetrics/error)

The underlying error present when the metrics are invalid.

### Creating metrics

[`init(classificationError:confusion:precisionRecall:)`](/documentation/CreateML/MLClassifierMetrics/init(classificationError:confusion:precisionRecall:))

Creates empty classifier metrics.

### Describing metrics

[`description`](/documentation/CreateML/MLClassifierMetrics/description)

A text representation of the classifier metrics.

[`debugDescription`](/documentation/CreateML/MLClassifierMetrics/debugDescription)

A text representation of the classifier metrics that’s suitable for output during debugging.

[`playgroundDescription`](/documentation/CreateML/MLClassifierMetrics/playgroundDescription)

A description of the classifier metrics shown in a playground.



---

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)