---
title: "fitted(toWindows:eventHandler:)"
framework: createmlcomponents
role: symbol
role_heading: Instance Method
path: "createmlcomponents/lineartimeseriesforecaster/fitted(towindows:eventhandler:)"
---

# fitted(toWindows:eventHandler:)

Fits a model to a sequence of windows.

## Declaration

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

## Parameters

- `input`: A sequence of annotated windows. Each window’s shape should be [inputWindowSize, featureSize] and each annotation’s shape should be [forecastWindowSize, annotationSize].
- `eventHandler`: An event handler.

## Return Value

Return Value The fitted model.

## See Also

### Updating and fitting

- [update(_:with:)](createmlcomponents/lineartimeseriesforecaster/update(_:with:).md)
- [update(_:withWindows:eventHandler:)](createmlcomponents/lineartimeseriesforecaster/update(_:withwindows:eventhandler:).md)
- [fitted(to:eventHandler:)](createmlcomponents/lineartimeseriesforecaster/fitted(to:eventhandler:).md)
- [fitted(to:validateOn:eventHandler:)](createmlcomponents/lineartimeseriesforecaster/fitted(to:validateon:eventhandler:).md)
- [fitted(toWindows:validateOn:eventHandler:)](createmlcomponents/lineartimeseriesforecaster/fitted(towindows:validateon:eventhandler:).md)
