Structure

MLRandomForestRegressor

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

Declaration

struct MLRandomForestRegressor

Topics

Creating and Training a Random Forest Regressor

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

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

struct MLRandomForestRegressor.ModelParameters

Parameters that affect the process of training a model.

let modelParameters: MLRandomForestRegressor.ModelParameters

The underlying parameters used when training the model.

var targetColumn: String

The name of the column you selected at initialization to define which feature the regressor predicts.

var featureColumns: [String]

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

Assessing Model Accuracy

var trainingMetrics: MLRegressorMetrics

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

var validationMetrics: MLRegressorMetrics

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

Evaluating a Random Forest Regressor

func evaluation(on: MLDataTable) -> MLRegressorMetrics

Returns metrics describing the regressor’s performance on the provided labeled data.

Testing a Random Forest Regressor

func predictions(from: MLDataTable) -> MLUntypedColumn

Predicts the target value from the provided data.

Saving a Random Forest Regressor

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 Regressor

var model: MLModel

The underlying Core ML model stored in memory.

var description: String

A text representation of the random forest regressor.

var debugDescription: String

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

var playgroundDescription: Any

A description of the random forest regressor shown in a playground.

See Also

Supporting Regressor Types

struct MLLinearRegressor

A regressor that estimates the target as a linear function of the features.

struct MLDecisionTreeRegressor

A regressor that estimates the target by learning rules to split the data.

struct MLBoostedTreeRegressor

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