<!--
{
  "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/LinearTimeSeriesForecaster",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents26LinearTimeSeriesForecasterV"
  },
  "title" : "LinearTimeSeriesForecaster"
}
-->

# LinearTimeSeriesForecaster

A time-series forecasting estimator.

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

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

## Topics

### Creating a linear time series forecaster

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

Creates a linear time-series forecaster.

### Inspecting a linear time series forecaster

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

The configuration.

[`var forecastWindowSize: Int`](/documentation/CreateMLComponents/LinearTimeSeriesForecaster/forecastWindowSize)

The number of predicted samples.

[`var inputWindowSize: Int`](/documentation/CreateMLComponents/LinearTimeSeriesForecaster/inputWindowSize)

The number of input samples.

### Updating and fitting

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

Updates a model with a new batch of examples.

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

Updates a model with a sequence of windows.

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

Fits a model to a sequence of examples.

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

Fits a model to a sequence of examples with validation.

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

Fits a model to a sequence of windows.

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

Fits a model to a sequence of annotated windows with validation.

### Supporting types

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

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

A linear time-series forecasting model.

### Default Implementations

[SupervisedEstimator Implementations](/documentation/CreateMLComponents/LinearTimeSeriesForecaster/SupervisedEstimator-Implementations)

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

## Relationships

### Conforms To

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

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

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

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

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

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

---

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)