Recommended Free Tools
To develop a convolutional neural network (CNN) for time series forecasting, first define when each forecast is made, what information is available at that moment, and how many future values the model must predict. Turn the chronological data into aligned input–target examples, train a 1D convolutional model on those windows, and evaluate it on later dates against a simple baseline. The right input and output shapes depend on whether you have one series or several, and whether you need one forecast value or a multi-step forecast.
1. Define the forecast before designing the CNN
Write down the forecast origin (the time at which a prediction is issued), the lookback (how many past steps the model can use), and the horizon (how many future steps it must predict). Also list the features genuinely available at each forecast origin. These decisions determine how to build training examples and the model’s output.
- Forecast origin: the latest time whose information may be used to make a prediction.
- Lookback: the number of historical steps supplied to the model.
- Horizon: the number of future steps being forecast.
- Features: the target’s history and any other variables available at the forecast origin.
For example, if a daily forecast is issued after day t, a lookback of 30 days uses days t−29 through t. A one-step target is the value at t+1; a seven-step target is the sequence from t+1 through t+7. Never include a value in an input window if it would not yet be known when that forecast is issued.
2. Turn the series into supervised windows
A CNN learns from examples that pair a fixed-length history with a target. Slide a window through the series in chronological order: each window contains the observations available at one forecast origin, and its label contains the value or values to predict after that origin. Keep each input window aligned with its own target; an off-by-one error can train a model to predict the wrong time step.
#1 Best Overall
In Keras’ common channels-last convention, a batch of inputs has shape (batch, steps, channels). Here, steps is the lookback length and channels is the number of input features. A univariate window of 30 values, for instance, has 30 steps and one channel; a window with the target and two additional features has three channels. The official Keras Conv1D documentation describes this layout.
For supervised targets, a one-value forecast is commonly represented as one value per example, while a direct multi-step forecast contains a vector of future values per example. If there are multiple target series, the output must represent each target as well as each forecast step. Make the meaning and ordering of each output dimension explicit so the model’s predictions can be mapped back to the correct series and dates.
3. Choose the input and output setup
The tutorial examples cover four broad cases: univariate input/output, multivariate input/output, multi-step output, and multivariate multi-step forecasting. They are useful as model-construction patterns, not as a tuned recipe; their illustrative configurations are arbitrary and do not establish that a CNN is the best choice for a particular dataset.
Rank #2
| Forecasting case | Input | Output | Design implication |
|---|---|---|---|
| Univariate, one step | Past values of one series | One future value | Use a single target for each input window. |
| Multivariate, one step | Past values of several features or series | One future value or target vector | Keep features as channels and specify which series are forecast targets. |
| Univariate, multi-step | Past values of one series | A vector of future values | Train for the full horizon and evaluate each forecast step. |
| Multivariate, multi-step | Past values of several features or series | Future vectors for one or more targets | Define how each target series maps to its horizon outputs; shared-channel inputs and separate CNN heads are possible patterns. |
A direct multi-step model predicts all requested future steps in one output rather than repeatedly feeding its own previous prediction back as a new input. This makes the training target and output shape straightforward, but it does not remove the need to check performance across the whole horizon. The multi-step tutorial demonstrates a household-power forecasting example with a forecast vector and subsequent forecast windows; those task-specific results should not be treated as general performance expectations.
Free tools Windows power users keep installed
One-click scans. No signup required.
4. Build a temporal convolution model
A 1D convolution applies filters along the time axis. For an input shaped (batch, steps, channels), the layer processes patterns across neighboring time positions while using the channels as feature dimensions. In Keras, Conv1D exposes padding choices including valid, same, and causal, as well as a dilation rate. With causal padding, the output at time position t does not depend on input positions after t, according to the Keras documentation.
Choose padding and architecture to suit the task. A model that produces an output at every time position may need causal padding so a position cannot consume later inputs. A window-to-vector forecast instead produces its final prediction from the supplied historical window; regardless of padding, the input window and labels must still respect the forecast origin. Causal padding cannot repair future information already included in an input, leakage from preprocessing, or an invalid train/test split.
Rank #3
Think of the lookback and the model’s receptive field together: the receptive field is the span of input positions that can influence an output. A long lookback alone does not guarantee the model can use all of it if the architecture’s receptive field is shorter. Conversely, a very large receptive field is not automatically beneficial. Select the window and convolution design using validation forecasts that match the intended horizon and deployment pattern.
Code examples in Jason Brownlee’s August 28, 2020 CNN forecasting tutorial use older Keras import paths. Check the API for the TensorFlow and Keras versions installed in your environment before reproducing code; the current layer interface and input conventions are documented by Keras.
5. Prevent leakage in preprocessing and splits
Preserve time order when creating training, validation, and test sets. Randomly shuffling windows across the full series can put future periods into training while earlier periods are used for evaluation, which does not represent forecasting into the future. Fit any learned preprocessing transformation—such as a scaler—using training data only, then apply that fitted transformation to validation and test data. A related financial time-series tutorial illustrates a chronological cutoff and this training-only fitting pattern; its classification task is not evidence of forecasting accuracy.
Rank #4
- Used Book in Good Condition
At each evaluation forecast origin, ensure every input feature would actually be available then. This matters especially for externally supplied variables: a feature may be recorded for a future date but not known at the time the forecast is issued. Label windows must also lie strictly in the intended evaluation period, and any overlap between historical context windows should reflect what would be available in real use rather than leak future labels.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.6. Evaluate against baselines at the intended horizon
Start with a simple forecast that is appropriate for the series, such as carrying forward the latest observed value, then compare the CNN using a metric relevant to the task. Report the horizon and evaluation period with the metric. For multi-step output, inspect errors by forecast step as well as across the complete horizon; a single average can conceal that performance degrades further into the future.
Use a chronological holdout when the practical question is how the model performs on a later period. If deployment will issue new forecasts repeatedly as observations arrive, rolling-origin or walk-forward evaluation is more representative: move the forecast origin forward, issue the horizon from information available at each origin, and aggregate the resulting errors. The household-power example in the multi-step CNN tutorial demonstrates evaluating subsequent forecast windows.
Best Value
There is no general result in the cited material showing that CNNs beat other methods on arbitrary forecasting data. The 2018 study by Bai, Kolter, and Koltun, “An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling”, found its tested convolutional architecture outperformed canonical recurrent networks, including LSTMs, on the benchmark sequence tasks and datasets it evaluated. That is evidence to consider convolutional sequence models, not a guarantee for an individual forecasting problem. Keep the CNN only if it performs well in a fair backtest against a baseline and other relevant approaches.
7. A practical development checklist
- Specify the task: write down the forecast origin, lookback, features available then, target series, and horizon.
- Create aligned examples: make each input window end at its forecast origin and pair it with the correct next value or future vector.
- Set tensor shapes: use steps for ordered timesteps and channels for features; define target dimensions for each series and horizon step.
- Choose a CNN: select the temporal convolution and padding approach, checking that its receptive field covers useful history.
- Split chronologically: reserve later observations for validation and testing, and fit transformations on training data only.
- Backtest fairly: compare against a simple baseline over the same origins, periods, horizon, and metric; use rolling origins if forecasts will be repeated in deployment.
- Decide from results: assess errors across the horizon and retain the CNN only if the evidence on your series supports it.
For a more extensive set of step-by-step examples, Brownlee’s tutorial describes his book Deep Learning for Time Series Forecasting; verify the current edition and availability before purchasing.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

