Structure

MLRandomForestClassifier

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

Declaration

struct MLRandomForestClassifier

Topics

Creating and Training a Random Forest Classifier

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

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

struct MLRandomForestClassifier.ModelParameters

Parameters that affect the process of training a model.

let modelParameters: MLRandomForestClassifier.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 a Random Forest Classifier

func evaluation(on: MLDataTable) -> MLClassifierMetrics

Evaluates the classifier on the provided labeled data.

Testing a Random Forest Classifier

func predictions(from: MLDataTable) -> MLUntypedColumn

Classifies the provided data into the target categories.

Saving a Random Forest 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 Random Forest Classifier

var model: MLModel

The underlying Core ML model stored in memory.

var description: String

A text representation of the random forest classifier.

var debugDescription: String

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

var playgroundDescription: Any

A description of the random forest 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 MLBoostedTreeClassifier

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

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.