To train a neural network on historical temperature data to predict future temperatures, what technique is used to turn the long list of temperatures into pairs of 'input history' and 'output future'?
The technique used to transform a long list of historical temperature data into pairs of 'input history' and 'output future' for training a neural network is called sliding window or windowing. This method is specifically designed for preparing sequential data, such as time series like temperature records, for supervised learning tasks where past observations are used to predict future values.
To apply the sliding window technique, two essential parameters are defined: an input window size, also known as the look-back period, and an output window size, also known as the prediction horizon. These parameters determine the length of the sequences that will form the input and output parts of each training example.
The process begins by selecting a contiguous segment of the historical temperature data. This segment, whose length is determined by the input window size, constitutes the first 'input history'. Immediately following this input segment in the original data sequence, a subsequent contiguous segment of temperatures is selected. This subsequent segment, with a length defined by the output window size, becomes the corresponding 'output future'. Together, these two segments form one complete training example: an 'input history' and its associated 'output future'.
Once the first pair is generated, the entire conceptual window, encompassing both the input and output segments, is then slid forward by a fixed number of data points, typically one, along the original historical temperature sequence. This movement generates the next unique 'input history' and 'output future' pair. This sliding process continues iteratively through the entire list of historical temperature data, generating numerous such pairs. Each generated pair serves as an independent training example for the neural network, allowing it to learn the relationship between past temperature patterns and future temperature outcomes.
For instance, given a temperature sequence T1, T2, T3, T4, T5, T6, T7, T8, if the goal is to predict the next two temperatures (output window size = 2) based on the previous three temperatures (input window size = 3):
The first training pair would be: Input history = [T1, T2, T3], Output future = [T4, T5].
The window then slides forward by one position.
The second training pair would be: Input history = [T2, T3, T4], Output future = [T5, T6].
This continues until no more complete input and output sequences can be formed from the remaining data.