---
title: MLClassifier
framework: createml
role: symbol
role_heading: Enumeration
path: createml/mlclassifier
---

# MLClassifier

A model you train to classify data into discrete categories.

## Declaration

```swift
enum MLClassifier
```

## Mentioned in

Improving Your Model’s Accuracy

## Overview

Overview Use an 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 MLClassifier. Instead, use the MLImageClassifierBuilder or one of the Natural Language models (MLTextClassifier or MLWordTagger). When you create an 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:)](createml/mlclassifier/init(trainingdata:targetcolumn:featurecolumns:).md)
- [targetColumn](createml/mlclassifier/targetcolumn.md)
- [featureColumns](createml/mlclassifier/featurecolumns.md)

### Evaluating a classifier

- [evaluation(on:)](createml/mlclassifier/evaluation(on:).md)
- [trainingMetrics](createml/mlclassifier/trainingmetrics.md)
- [validationMetrics](createml/mlclassifier/validationmetrics.md)

### Testing a classifier

- [predictions(from:)](createml/mlclassifier/predictions(from:).md)

### Saving a classifier

- [write(to:metadata:)](createml/mlclassifier/write(to:metadata:).md)
- [write(toFile:metadata:)](createml/mlclassifier/write(tofile:metadata:).md)

### Describing a model

- [model](createml/mlclassifier/model.md)
- [description](createml/mlclassifier/description.md)
- [debugDescription](createml/mlclassifier/debugdescription.md)
- [playgroundDescription](createml/mlclassifier/playgrounddescription.md)

### Classifier cases

- [MLClassifier.decisionTree(_:)](createml/mlclassifier/decisiontree(_:).md)
- [MLClassifier.randomForest(_:)](createml/mlclassifier/randomforest(_:).md)
- [MLClassifier.boostedTree(_:)](createml/mlclassifier/boostedtree(_:).md)
- [MLClassifier.logisticRegression(_:)](createml/mlclassifier/logisticregression(_:).md)
- [MLClassifier.supportVector(_:)](createml/mlclassifier/supportvector(_:).md)

### Supporting classifier types

- [MLDecisionTreeClassifier](createml/mldecisiontreeclassifier.md)
- [MLRandomForestClassifier](createml/mlrandomforestclassifier.md)
- [MLBoostedTreeClassifier](createml/mlboostedtreeclassifier.md)
- [MLLogisticRegressionClassifier](createml/mllogisticregressionclassifier.md)
- [MLSupportVectorClassifier](createml/mlsupportvectorclassifier.md)

### Default Implementations

- [CustomDebugStringConvertible Implementations](createml/mlclassifier/customdebugstringconvertible-implementations.md)
- [CustomPlaygroundDisplayConvertible Implementations](createml/mlclassifier/customplaygrounddisplayconvertible-implementations.md)
- [CustomStringConvertible Implementations](createml/mlclassifier/customstringconvertible-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomPlaygroundDisplayConvertible](swift/customplaygrounddisplayconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Escapable](swift/escapable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Tabular models

- [Creating a model from tabular data](createml/creating-a-model-from-tabular-data.md)
- [MLRegressor](createml/mlregressor.md)
- [MLRecommender](createml/mlrecommender.md)
