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

# MLDecisionTreeClassifier

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

```
struct MLDecisionTreeClassifier
```

## Topics

### Training a decision tree classifier asynchronously

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

Creates a decision tree classifier.

[`static makeTrainingSession(trainingData:targetColumn:featureColumns:parameters:sessionParameters:)`](/documentation/CreateML/MLDecisionTreeClassifier/makeTrainingSession(trainingData:targetColumn:featureColumns:parameters:sessionParameters:))

Creates or restores a training session.

[`static func resume(MLTrainingSession<MLDecisionTreeClassifier>) throws -> MLJob<MLDecisionTreeClassifier>`](/documentation/CreateML/MLDecisionTreeClassifier/resume(_:))

Resumes a training session from the last checkpoint if available.

[`static func restoreTrainingSession(sessionParameters: MLTrainingSessionParameters) throws -> MLTrainingSession<MLDecisionTreeClassifier>`](/documentation/CreateML/MLDecisionTreeClassifier/restoreTrainingSession(sessionParameters:))

Restores an existing training session.

### Creating a decision tree classifier from a checkpoint

[`init(checkpoint: MLCheckpoint) throws`](/documentation/CreateML/MLDecisionTreeClassifier/init(checkpoint:))

Creates a decision tree classifier classifier  from a checkpoint.

### Training a decision tree classifier synchronously

[`static train(trainingData:targetColumn:featureColumns:parameters:sessionParameters:)`](/documentation/CreateML/MLDecisionTreeClassifier/train(trainingData:targetColumn:featureColumns:parameters:sessionParameters:))

Trains a decision tree classifier.

[`var targetColumn: String`](/documentation/CreateML/MLDecisionTreeClassifier/targetColumn)

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

[`var featureColumns: [String]`](/documentation/CreateML/MLDecisionTreeClassifier/featureColumns)

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

### Evaluating a decision tree classifier

[`func evaluation(on:)`](/documentation/CreateML/MLDecisionTreeClassifier/evaluation(on:))

Evaluates the classifier on the provided labeled data.

[`var trainingMetrics: MLClassifierMetrics`](/documentation/CreateML/MLDecisionTreeClassifier/trainingMetrics)

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

[`var validationMetrics: MLClassifierMetrics`](/documentation/CreateML/MLDecisionTreeClassifier/validationMetrics)

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

### Testing a decision tree classifier

[`func predictions(from:)`](/documentation/CreateML/MLDecisionTreeClassifier/predictions(from:))

Predicts a column of labels for the given testing data.

### Saving a decision tree classifier

[`func write(to: URL, metadata: MLModelMetadata?) throws`](/documentation/CreateML/MLDecisionTreeClassifier/write(to:metadata:))

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

[`func write(toFile: String, metadata: MLModelMetadata?) throws`](/documentation/CreateML/MLDecisionTreeClassifier/write(toFile:metadata:))

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

### Inspecting a decision tree classifier

[`var model: MLModel`](/documentation/CreateML/MLDecisionTreeClassifier/model)

The Core ML model.

[`struct ModelParameters`](/documentation/CreateML/MLDecisionTreeClassifier/ModelParameters-swift.struct)

Parameters that affect the process of training a model.

[`let modelParameters: MLDecisionTreeClassifier.ModelParameters`](/documentation/CreateML/MLDecisionTreeClassifier/modelParameters-swift.property)

The underlying parameters used when training the model.

### Describing a decision tree classifier

[`var description: String`](/documentation/CreateML/MLDecisionTreeClassifier/description)

A text representation of the decision tree classifier.

[`var debugDescription: String`](/documentation/CreateML/MLDecisionTreeClassifier/debugDescription)

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

[`var playgroundDescription: Any`](/documentation/CreateML/MLDecisionTreeClassifier/playgroundDescription)

A description of the decision tree classifier shown in a playground.

### Default Implementations

[CustomDebugStringConvertible Implementations](/documentation/CreateML/MLDecisionTreeClassifier/CustomDebugStringConvertible-Implementations)

[CustomPlaygroundDisplayConvertible Implementations](/documentation/CreateML/MLDecisionTreeClassifier/CustomPlaygroundDisplayConvertible-Implementations)

[CustomStringConvertible Implementations](/documentation/CreateML/MLDecisionTreeClassifier/CustomStringConvertible-Implementations)

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Copyable`](/documentation/Swift/Copyable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Escapable`](/documentation/Swift/Escapable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomPlaygroundDisplayConvertible`](/documentation/Swift/CustomPlaygroundDisplayConvertible)

---

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)