<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/MultivariateLinearRegressor",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents27MultivariateLinearRegressorV"
  },
  "title" : "MultivariateLinearRegressor"
}
-->

# MultivariateLinearRegressor

A multivariate linear regressor.

```
struct MultivariateLinearRegressor<Scalar> where Scalar : MLShapedArrayScalar, Scalar : BinaryFloatingPoint
```

## Overview

Unlike a [`LinearRegressor`](/documentation/CreateMLComponents/LinearRegressor), a [`MultivariateLinearRegressor`](/documentation/CreateMLComponents/MultivariateLinearRegressor) supports shaped array outputs with any number of
elements. It also provides a wider range of training options better suited for large multi-dimensional regression.

> Note: Only `Float` and `Double` are currently supported as the Scalar type. You may get faster training
> when using `Float`.

## Topics

### Creating a regressor

[`init(configuration: MultivariateLinearRegressor<Scalar>.Configuration)`](/documentation/CreateMLComponents/MultivariateLinearRegressor/init(configuration:))

Creates a multivariate linear regressor.

### Getting the configuration

[`var configuration: MultivariateLinearRegressor<Scalar>.Configuration`](/documentation/CreateMLComponents/MultivariateLinearRegressor/configuration-swift.property)

The linear regressor configuration.

### Fitting

[`func fitted(to: some Sequence<AnnotatedFeature<MLShapedArray<Scalar>, MLShapedArray<Scalar>>>, eventHandler: EventHandler?) async throws -> MultivariateLinearRegressor<Scalar>.Model`](/documentation/CreateMLComponents/MultivariateLinearRegressor/fitted(to:eventHandler:))

Fits a linear regressor model to a sequence of annotated features.

[`func fitted(to:validateOn:eventHandler:)`](/documentation/CreateMLComponents/MultivariateLinearRegressor/fitted(to:validateOn:eventHandler:))

Fits a linear regressor model to shaped arrays of features and annotations.

### Fitting Progressively

[`func makeTransformer() -> MultivariateLinearRegressor<Scalar>.Model`](/documentation/CreateMLComponents/MultivariateLinearRegressor/makeTransformer())

Creates a default-initialized model suitable for incremental fitting.

[`func update(inout MultivariateLinearRegressor<Scalar>.Model, with: some Sequence<AnnotatedFeature<MLShapedArray<Scalar>, MLShapedArray<Scalar>>>, eventHandler: EventHandler?) async throws`](/documentation/CreateMLComponents/MultivariateLinearRegressor/update(_:with:eventHandler:))

Updates a model with a new sequence of examples.

[`func update(inout MultivariateLinearRegressor<Scalar>.Model, with: AnnotatedBatch<Scalar>) async throws -> Scalar`](/documentation/CreateMLComponents/MultivariateLinearRegressor/update(_:with:))

Updates a model with a new shaped array of examples.

### Encoding and decoding

[`func encodeWithOptimizer(MultivariateLinearRegressor<Scalar>.Model, to: inout any EstimatorEncoder) throws`](/documentation/CreateMLComponents/MultivariateLinearRegressor/encodeWithOptimizer(_:to:))

Encodes the model and optimizer to an encoder.

[`func decodeWithOptimizer(from: inout any EstimatorDecoder) throws -> MultivariateLinearRegressor<Scalar>.Model`](/documentation/CreateMLComponents/MultivariateLinearRegressor/decodeWithOptimizer(from:))

Reads the encoded model and optimizer with a decoder.

### Supporting types

[`struct Model`](/documentation/CreateMLComponents/MultivariateLinearRegressor/Model)

A trained multivariate linear regressor model.

[`typealias Annotation`](/documentation/CreateMLComponents/MultivariateLinearRegressor/Annotation)

The annotation type.

[`typealias Configuration`](/documentation/CreateMLComponents/MultivariateLinearRegressor/Configuration-swift.typealias)

[`typealias Feature`](/documentation/CreateMLComponents/MultivariateLinearRegressor/Feature)

The feature type.

[`typealias Transformer`](/documentation/CreateMLComponents/MultivariateLinearRegressor/Transformer)

The transformer type created by this estimator.

### Default Implementations

[UpdatableSupervisedEstimator Implementations](/documentation/CreateMLComponents/MultivariateLinearRegressor/UpdatableSupervisedEstimator-Implementations)

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Escapable`](/documentation/Swift/Escapable)

[`Copyable`](/documentation/Swift/Copyable)

[`UpdatableSupervisedEstimator`](/documentation/CreateMLComponents/UpdatableSupervisedEstimator)

[`SupervisedEstimator`](/documentation/CreateMLComponents/SupervisedEstimator)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)