<!--
{
  "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/classificationError",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML19MLClassifierMetricsV19classificationErrorSdvp"
  },
  "title" : "classificationError"
}
-->

# classificationError

The fraction of incorrectly labeled examples.

```
var classificationError: Double { get }
```

## Discussion

The classification error describes how many examples were incorrectly labeled divided by the total number of
examples. Accuracy as a percentage may be more intuitive. You can calculate it as follows:

```swift
let accuracy = (1 - metrics.classificationError) * 100
```

> Important: This is a useful metric only when the data is well-balanced between categories. For example,
> suppose you build a classifier to detect a rare disease with very few examples of sick patients compared
> to the number of healthy patients. Predicting that a new patient will always be healthy would be highly
> accurate (low classification error), but a poor disease detector. The ``doc://com.apple.createml/documentation/CreateML/MLClassifierMetrics/precisionRecall``
> and ``doc://com.apple.createml/documentation/CreateML/MLClassifierMetrics/confusion`` properties provide more detail in these cases.

---

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)