<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLLinearRegressor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML17MLLinearRegressorV"
  },
  "title" : "MLLinearRegressor"
}
-->

# MLLinearRegressor

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

```
struct MLLinearRegressor
```

## Topics

### Creating a linear regressor asynchronously

[`train(trainingData:targetColumn:featureColumns:parameters:sessionParameters:)`](/documentation/CreateML/MLLinearRegressor/train(trainingData:targetColumn:featureColumns:parameters:sessionParameters:))

Trains a linear regressor.

[`makeTrainingSession(trainingData:targetColumn:featureColumns:parameters:sessionParameters:)`](/documentation/CreateML/MLLinearRegressor/makeTrainingSession(trainingData:targetColumn:featureColumns:parameters:sessionParameters:))

Creates or restores a training session.

[`resume(_:)`](/documentation/CreateML/MLLinearRegressor/resume(_:))

Resumes a training session from the last checkpoint if available.

[`restoreTrainingSession(sessionParameters:)`](/documentation/CreateML/MLLinearRegressor/restoreTrainingSession(sessionParameters:))

Restores an existing training session.

### Creating a linear regressor from a checkpoint

[`init(checkpoint:)`](/documentation/CreateML/MLLinearRegressor/init(checkpoint:))

Creates a linear regressor from a checkpoint.

### Training a linear regressor synchronously

[`init(trainingData:targetColumn:featureColumns:parameters:)`](/documentation/CreateML/MLLinearRegressor/init(trainingData:targetColumn:featureColumns:parameters:))

Creates a linear regressor.

[`targetColumn`](/documentation/CreateML/MLLinearRegressor/targetColumn)

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

[`featureColumns`](/documentation/CreateML/MLLinearRegressor/featureColumns)

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

### Evaluating a linear regressor

[`evaluation(on:)`](/documentation/CreateML/MLLinearRegressor/evaluation(on:))

Evaluates the classifier on the provided labeled data.

[`trainingMetrics`](/documentation/CreateML/MLLinearRegressor/trainingMetrics)

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

[`validationMetrics`](/documentation/CreateML/MLLinearRegressor/validationMetrics)

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

### Testing a linear regressor

[`predictions(from:)`](/documentation/CreateML/MLLinearRegressor/predictions(from:))

Predicts a column of labels for the given testing data.

### Saving a linear regressor

[`write(to:metadata:)`](/documentation/CreateML/MLLinearRegressor/write(to:metadata:))

Exports a Core ML model file for use in your app.

[`write(toFile:metadata:)`](/documentation/CreateML/MLLinearRegressor/write(toFile:metadata:))

Exports a Core ML model file for use in your app.

### Inspecting a linear regressor

[`model`](/documentation/CreateML/MLLinearRegressor/model)

The Core ML model.

[`MLLinearRegressor.ModelParameters`](/documentation/CreateML/MLLinearRegressor/ModelParameters-swift.struct)

Parameters that affect the process of training a model.

[`modelParameters`](/documentation/CreateML/MLLinearRegressor/modelParameters-swift.property)

The underlying parameters used when training the model.

### Describing a linear regressor

[`description`](/documentation/CreateML/MLLinearRegressor/description)

A text representation of the linear regressor.

[`debugDescription`](/documentation/CreateML/MLLinearRegressor/debugDescription)

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

[`playgroundDescription`](/documentation/CreateML/MLLinearRegressor/playgroundDescription)

A description of the linear regressor shown in a playground.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)