Contents

train(trainingData:targetColumn:featureColumns:parameters:sessionParameters:)

Trains a random forest regressor.

Declaration

static func train(trainingData: DataFrame, targetColumn: String, featureColumns: [String]? = nil, parameters: MLRandomForestRegressor.ModelParameters = .init(validation: .split(strategy: .automatic)), sessionParameters: MLTrainingSessionParameters = _defaultSessionParameters) throws -> MLJob<MLRandomForestRegressor>

Parameters

  • trainingData:

    A DataFrame specifying training data.

  • targetColumn:

    A String specifying the target column name in the trainingData

  • featureColumns:

    An optional list of Strings specifying feature columns to be used to predict the target, if not provided, default to use all the other columns in the trainingData, except the one specified by targetColumn

  • parameters:

    Model training parameters. See Modelparameters Swift.struct for the defaults.

  • sessionParameters:

    Training session parameters. See Mltrainingsessionparameters for the defaults.

Return Value

A MLJob that can be used to observe training progress.

Discussion

If sessionDirectory is provided it will save training progress. If there is progress already saved training will resume from the last checkpoint.

See Also

Training a random forest regressor