Structure

MLBoostedTreeClassifier

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

Declaration

struct MLBoostedTreeClassifier

Overview

A boosted tree classifier combines several MLDecisionTreeClassifier models (a technique known as ensemble learning) by training each model to correct the errors of the preceeding model.

This model is useful for handling numerical and categorical features, but is less suitable for sparse data such as text.

Topics

Creating and Training a Boosted Tree Classifier

init(trainingData: MLDataTable, targetColumn: String, featureColumns: [String]?, parameters: MLBoostedTreeClassifier.ModelParameters)

Creates a Boosted Tree Classifier from the feature columns in the training data to predict the categories in the target column.

struct MLBoostedTreeClassifier.ModelParameters

Parameters that affect the process of training a model.

let modelParameters: MLBoostedTreeClassifier.ModelParameters

The underlying parameters used when training the model.

var targetColumn: String

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

var featureColumns: [String]

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

Assessing Model Accuracy

var trainingMetrics: MLClassifierMetrics

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

var validationMetrics: MLClassifierMetrics

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

Evaluating the Boosted Tree Classifier

func evaluation(on: MLDataTable) -> MLClassifierMetrics

Evaluates the classifier on the provided labeled data.

Testing a Boosted Tree Classifier

func predictions(from: MLDataTable) -> MLUntypedColumn

Classifies the provided data into the target categories.

Saving a Boosted Tree Classifier

func write(to: URL, metadata: MLModelMetadata?)

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

func write(toFile: String, metadata: MLModelMetadata?)

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

Describing a Boosted Tree Classifier

var model: MLModel

The underlying Core ML model stored in memory.

var description: String

A text representation of the boosted tree classifier.

var debugDescription: String

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

var playgroundDescription: Any

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

See Also

Supporting Classifier Types

struct MLDecisionTreeClassifier

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

struct MLRandomForestClassifier

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

struct MLLogisticRegressionClassifier

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

struct MLSupportVectorClassifier

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