Initializer

init(trainingData:featureColumns:labelColumn:recordingFileColumn:parameters:)

Creates an activity classifier from a training set represented by a data table.

Declaration

init(trainingData: MLDataTable, featureColumns: [String], labelColumn: String, recordingFileColumn: String, parameters: MLActivityClassifier.ModelParameters = ModelParameters()) throws

Parameters

trainingData

The activity data that you provide to train this model, contained in an MLDataTable.

featureColumns

The names of the columns containing the sensor data.

labelColumn

The name of the column containing the activity labels.

recordingFileColumn

The name of the column containing the recording file names.

parameters

Parameters that you use to configure model training.

Discussion

Use this initializer to create an activity classifier with an MLDataTable. To configure the training process, initialize the activity classifier with an MLActivityClassifier.ModelParameters instance. For example, you can explicitly define the validation data set instead of allowing the model to choose a random selection of your training data. Alternatively, set validationData to nil to allow the activity classifier to choose the validation data for you from among your training data. This lets you set other parameters—like maximumIterations and batchSize—to non-default values.

See Also

Creating and Training an Activity Classifier

enum MLActivityClassifier.DataSource

A data source for an activity classifier.

struct MLActivityClassifier.ModelParameters

Parameters that affect the process of training an activity classification model.

let modelParameters: MLActivityClassifier.ModelParameters

The configuration parameters that the activity classifier used for training during initialization.

var featureColumns: [String]

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

var labelColumn: String

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

var recordingFileColumn: String

The name of the column the classifier used at initialization that contains the file names of the activity recordings.