<!--
{
  "availability" : [
    "macOS: 10.14.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLClassifier",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML12MLClassifierO"
  },
  "title" : "MLClassifier"
}
-->

# MLClassifier

A model you train to classify data into discrete categories.

```
enum MLClassifier
```

## Overview

Use an [`MLClassifier`](/documentation/CreateML/MLClassifier) to train a general-purpose model to recognize categories.

For example, you can create a classifier that predicts whether a sports team is likely to win or lose its next game
by training it with these inputs:

- The team’s win-loss ratio
- The team’s game locations

> Important: When working with image or natural language data, don’t use ``doc://com.apple.createml/documentation/CreateML/MLClassifier``. Instead, use the
> `MLImageClassifierBuilder` or one of the Natural Language models (``doc://com.apple.createml/documentation/CreateML/MLTextClassifier`` or ``doc://com.apple.createml/documentation/CreateML/MLWordTagger``).

When you create an [`MLClassifier`](/documentation/CreateML/MLClassifier), Create ML inspects your data and automatically chooses a specific classifier
(see *Supporting Classifier Types*).

## Topics

### Creating and training a classifier

[`init(trainingData:targetColumn:featureColumns:)`](/documentation/CreateML/MLClassifier/init(trainingData:targetColumn:featureColumns:))

Creates a classifier.

[`targetColumn`](/documentation/CreateML/MLClassifier/targetColumn)

The name of the column you selected at initialization to define which
categories the classifier predicts.

[`featureColumns`](/documentation/CreateML/MLClassifier/featureColumns)

The names of the columns you selected at initialization to train the
classifier.

### Evaluating a classifier

[`evaluation(on:)`](/documentation/CreateML/MLClassifier/evaluation(on:))

Evaluates the classifier on the provided labeled data.

[`trainingMetrics`](/documentation/CreateML/MLClassifier/trainingMetrics)

Measurements of the classifier’s performance on the training data set.

[`validationMetrics`](/documentation/CreateML/MLClassifier/validationMetrics)

Measurements of the classifier’s performance on the validation data set.

### Testing a classifier

[`predictions(from:)`](/documentation/CreateML/MLClassifier/predictions(from:))

### Saving a classifier

[`write(to:metadata:)`](/documentation/CreateML/MLClassifier/write(to:metadata:))

Exports a Core ML model file for use in your app.

[`write(toFile:metadata:)`](/documentation/CreateML/MLClassifier/write(toFile:metadata:))

Exports a Core ML model file for use in your app.

### Describing a model

[`model`](/documentation/CreateML/MLClassifier/model)

The underlying Core ML model stored in memory.

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

A text representation of the classifier.

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

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

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

A description of the classifier shown in a playground.

### Classifier cases

[`MLClassifier.decisionTree(_:)`](/documentation/CreateML/MLClassifier/decisionTree(_:))

A classifier that predicts the target by creating rules to split the data.

[`MLClassifier.randomForest(_:)`](/documentation/CreateML/MLClassifier/randomForest(_:))

A classifier based on a collection of decision trees trained on subsets of the data.

[`MLClassifier.boostedTree(_:)`](/documentation/CreateML/MLClassifier/boostedTree(_:))

A classifier based on a collection of decision trees combined with gradient boosting.

[`MLClassifier.logisticRegression(_:)`](/documentation/CreateML/MLClassifier/logisticRegression(_:))

A classifier that predicts a discrete target value as a function of data features.

[`MLClassifier.supportVector(_:)`](/documentation/CreateML/MLClassifier/supportVector(_:))

A classifier that predicts a binary target value by maximizing the separation between categories.

### Supporting classifier types

[`MLDecisionTreeClassifier`](/documentation/CreateML/MLDecisionTreeClassifier)

A classifier that predicts the target by creating rules to split the data.

[`MLRandomForestClassifier`](/documentation/CreateML/MLRandomForestClassifier)

A classifier based on a collection of decision trees trained on subsets of the data.

[`MLBoostedTreeClassifier`](/documentation/CreateML/MLBoostedTreeClassifier)

A classifier based on a collection of decision trees combined with gradient boosting.

[`MLLogisticRegressionClassifier`](/documentation/CreateML/MLLogisticRegressionClassifier)

A classifier that predicts a discrete target value as a function of data features.

[`MLSupportVectorClassifier`](/documentation/CreateML/MLSupportVectorClassifier)

A classifier that predicts a binary target value by maximizing the separation between categories.



---

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)