---
title: TimeSeriesForecasterBatches
framework: createmlcomponents
role: symbol
role_heading: Structure
path: createmlcomponents/timeseriesforecasterbatches
---

# TimeSeriesForecasterBatches

A sequence of forecaster batches on a time series shaped array.

## Declaration

```swift
struct TimeSeriesForecasterBatches<Scalar> where Scalar : MLShapedArrayScalar
```

## Overview

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]. To train a forecaster, each training batch contains the input samples along with the annotations (ground truth predictions). For example a batch could have this: features = [     [1, 2, 3, 4],     [2, 3, 4, 5],     [3, 4, 5, 6], ] annotations = [     [5, 6],     [6, 7],     [7, 8], ] The shape of the features in the sequence is [batchSize, inputWindowSize, featureSize] and the shape of the annotations is [batchSize, forecastWindowSize, annotationSize]. The batch sequence will return as many feature-annotation examples as fit in the input. For example, an input sequence size of 10 with an input sample count of 4 and a prediction sample count of 2 will produce 5 examples: features: [1, 2, 3, 4], annotations: [5, 6] features: [2, 3, 4, 5], annotations: [6, 7] features: [3, 4, 5, 6], annotations: [7, 8] features: [4, 5, 6, 7], annotations: [8, 9] features: [5, 6, 7, 8], annotations: [9, 10] Note that 9 and 10 are never used as features because there would be no annotations for those examples.

## Topics

### Creating a time series forecaster batch

- [init(features:annotations:batchSize:inputWindowSize:forecastWindowSize:shufflesBatches:)](createmlcomponents/timeseriesforecasterbatches/init(features:annotations:batchsize:inputwindowsize:forecastwindowsize:shufflesbatches:).md)

### Inspecting a time series forecaster batch

- [annotations](createmlcomponents/timeseriesforecasterbatches/annotations.md)
- [batchSize](createmlcomponents/timeseriesforecasterbatches/batchsize.md)
- [features](createmlcomponents/timeseriesforecasterbatches/features.md)
- [forecastWindowSize](createmlcomponents/timeseriesforecasterbatches/forecastwindowsize.md)
- [inputWindowSize](createmlcomponents/timeseriesforecasterbatches/inputwindowsize.md)
- [shufflesBatches](createmlcomponents/timeseriesforecasterbatches/shufflesbatches.md)

### Default Implementations

- [Sequence Implementations](createmlcomponents/timeseriesforecasterbatches/sequence-implementations.md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Time-based components

- [Creating a time-series classifier](createmlcomponents/creating-a-time-series-classifier.md)
- [Creating a time-series forecaster](createmlcomponents/creating-a-time-series-forecaster.md)
- [DateFeatures](createmlcomponents/datefeatures.md)
- [DateFeatureExtractor](createmlcomponents/datefeatureextractor.md)
- [LinearTimeSeriesForecaster](createmlcomponents/lineartimeseriesforecaster.md)
- [LinearTimeSeriesForecasterConfiguration](createmlcomponents/lineartimeseriesforecasterconfiguration.md)
- [TimeSeriesForecasterAnnotatedWindows](createmlcomponents/timeseriesforecasterannotatedwindows.md)
- [TemporalFeature](createmlcomponents/temporalfeature.md)
- [TemporalSequence](createmlcomponents/temporalsequence.md)
- [TemporalSegmentIdentifier](createmlcomponents/temporalsegmentidentifier.md)
- [SlidingWindows](createmlcomponents/slidingwindows.md)
- [SlidingWindowTransformer](createmlcomponents/slidingwindowtransformer.md)
- [Downsampler](createmlcomponents/downsampler.md)
- [VideoReader](createmlcomponents/videoreader.md)
- [TemporalFileSegment](createmlcomponents/temporalfilesegment.md)
