Time series forecasts in WarpScript

In this article, we present the WarpScript extension for time series forecasting and show an exemple on power consumption data and another one on air passenger data.

Time Series Forecasts in WarpScript

A time series forecast is a regression problem, for which the input is a series of past values, and the result is the prediction of one or more values in the future.

In WarpScript, a paid extension called Warp10-ext-forecasting offers a set of WarpScript functions to find suitable forecast models on GTS and make predictions.

The Warp10-ext-forecasting is installed on the sandbox instance, so you can try it for free.

The documentation is avalaible on its WarpFleet page.

Presentation of the forecasting extension

This extension introduces the class of GTS forecast models, its WarpScript type is X-GTSFORECASTMODEL. Here, the X prefix means that this type is introduced by an extension.

A set of functions build and train forecast models. As can be seen in the document, multiple families of forecast models are implemented:

  • auto-regressive integrated moving averages models
    • e.g. ARIMA, SARIMA
  • exponential smoothing models (including holt-winters)
  • neural network models
    • e.g. LSTM, NNETAR

Another set of auto-ML functions allow the user to search for the best model and automatically choose the right hyper-parameters, e.g. the AUTO function.

Then, of course, there are also functions that take the GTS forecast model as argument. For example, FORECAST makes an actual forecast, and FORECAST.ANOMALIES uses a forecast in the past to detect outliers using real values against predictions.

Let's look at some examples.

Example 1: power consumption forecast

In this example, we will make use of power consumption data that is compressed in the macro @senx/dataset/power_consumption.

For example, in the code below, we make a forecast using a model of type SARIMA (here the letter S stands for seasonal).

# prepare the data: it needs ot be bucketized
@senx/dataset/power_consumption -1000 SHRINK
[ SWAP bucketizer.last 0 30 m 0 ] BUCKETIZE 'input_data' STORE

# plot the original data

# compute the forecast model (here we search for a SARIMA model with seasonality of 48 points i.e. 1 day)
# make a forecast for the next week and leave the gts to be plotted
$input_data 48 SEARCH.SARIMA


Forecast for the next week using a Seasonal ARIMA model
Forecast for the next week using a Seasonal ARIMA model

Example 2: Air Passengers forecast

In this example, we compare multiple forecast models for predicting the number of passengers of an airline company. Note that as a preprocessing transform, we bucketize by month. you can learn more about this in a previous blog post.


# preprocessing transform (bucketize by month)
[ SWAP bucketizer.mean ] @senx/cal/BUCKETIZE.bymonth
0 GET 'data' STORE

# train multiple forecast models that are quick to converge
  $data SEARCH.ARIMA 48 FORECAST { 'method' 'search.arima' } RELABEL
  $data 12 SEARCH.SARIMA 48 FORECAST { 'method' 'search.sarima' } RELABEL
  { 'gts' $data 'max evals' 10000 } SES 48 FORECAST { 'method' 'ses' } RELABEL
  { 'gts' $data 'cycle' 12 'max evals' 10000 } HOLTWINTERS 48 FORECAST { 'method' 'holtwinters' } RELABEL
  $data -50 SHRINK

# invert the preprocessing tranform
[ SWAP bucketizer.last 0 1 0 ] BUCKETIZE


Comparison of four forecast models
Comparison of four forecast models

It seems that SARIMA models (standing for Seasonal Auto Regressive Integrated Moving Average) are better suited to forecast this time series.

As an exercise, you can try the function SAUTO. You will see that it obtains the same forecast than with this SARIMA model.


The Warp10-ext-forecast brings forecasting functions to enhance your WarpScripts. This is a private extension that can be made available on your instance. You can reach us at contact@senx.io if you wish to do so. It is also available on the sandbox instance for free.