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

# TimeSeriesForecasterAnnotatedWindows

A sequence of forecasting windows on a time series shaped array.

```
struct TimeSeriesForecasterAnnotatedWindows<Scalar> where Scalar : MLShapedArrayScalar
```

## Overview

A time-series forecaster takes a series of samples and produces a prediction of the next samples.
For example the sequence `[1, 2, 3, 4]` could predict `[5, 6]`.

The shape of each feature in the sequence is `[inputWindowSize, featureSize]` and the shape of each annotation is
`[forecastWindowSize, annotationSize]`. The sequence will return as many feature-annotation examples as fit in
the input. For example an input sequence of size of 10 with an input sample count of 4, a prediction sample count
of 2, and a stride of 1 will produce 5 annotated windows:

```
feature: [1, 2, 3, 4], annotation: [5, 6]
feature: [2, 3, 4, 5], annotation: [6, 7]
feature: [3, 4, 5, 6], annotation: [7, 8]
feature: [4, 5, 6, 7], annotation: [8, 9]
feature: [5, 6, 7, 8], annotation: [9, 10]
```

Note that 9 and 10 are never used as features because there would be no annotations for those samples.

## Topics

### Creating a time series forecaster annotated window

[`init(features: MLShapedArray<Scalar>, annotations: MLShapedArray<Scalar>, inputWindowSize: Int, forecastWindowSize: Int, stride: Int, shufflesElements: Bool) throws`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/init(features:annotations:inputWindowSize:forecastWindowSize:stride:shufflesElements:))

Creates a batch sequence.

### Inspecting a time series forecaster annotated window

[`let annotations: MLShapedArray<Scalar>`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/annotations)

The original annotations.

[`let features: MLShapedArray<Scalar>`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/features)

The original features.

[`let forecastWindowSize: Int`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/forecastWindowSize)

The prediction sample count.

[`let inputWindowSize: Int`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/inputWindowSize)

The input sample count.

[`var shufflesElements: Bool`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/shufflesElements)

A Boolean value indicating whether to shuffle the elements.

[`var stride: Int`](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/stride)

The number of samples between windows.

### Default Implementations

[Sequence Implementations](/documentation/CreateMLComponents/TimeSeriesForecasterAnnotatedWindows/Sequence-Implementations)

## Relationships

### Conforms To

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

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

[`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)