---
title: "fitted(to:eventHandler:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/multivariatelinearregressor/fitted(to:eventhandler:)"
---

# fitted(to:eventHandler:)

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

## Declaration

```swift
func fitted(to input: some Sequence<AnnotatedFeature<MLShapedArray<Scalar>, MLShapedArray<Scalar>>>, eventHandler: EventHandler? = nil) async throws -> MultivariateLinearRegressor<Scalar>.Model
```

## Parameters

- `input`: A sequence of examples used for fitting the regressor. For faster processing, instead of passing a sequence of shaped arrays, consider passing a single shaped array containing all the training examples. For example instead of passing N shaped arrays with shape [M], pass a single shaped array with shape [N, M]. See doc://com.apple.createmlcomponents/documentation/CreateMLComponents/MultivariateLinearRegressor/fitted(to:validateOn:eventHandler:)-82szq.
- `eventHandler`: An event handler. This method reports mean squared errors.

## Return Value

Return Value The fitted linear regressor model.

## See Also

### Fitting

- [fitted(to:validateOn:eventHandler:)](createmlcomponents/multivariatelinearregressor/fitted(to:validateon:eventhandler:).md)
