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 together (known as ensembling) by training trees to correct for errors in their predecessor.

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

Topics

Creating and Training a Classifer

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.

Evaluating the Model

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.

func evaluation(on: MLDataTable) -> MLClassifierMetrics

Evaluates the classifier on the provided labeled data.

Testing a Model with Unlabeled Data

var featureColumns: [String]

The column names used by the classifer when accepting input data for classification.

var targetColumn: String

The name of the column you want the classifier to make predictions for.

func predictions(from: MLDataTable) -> MLUntypedColumn

Classifies the provided data into the target categories.

Saving a Model

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.

Inspecting a Model

var model: MLModel

The underlying Core ML model stored in memory.

let modelParameters: MLBoostedTreeClassifier.ModelParameters

The underlying parameters used when training the model.

Describing a Model

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.