AWS Forecast Guide

What Is Amazon Forecast?

Amazon Forecast is a fully managed service for time-series forecasting. By providing Amazon Forecast with historical time-series data, you can predict future points in the series. Time-series forecasting is useful in multiple domains, including retail, financial planning, supply chain, and healthcare. You can also use Amazon Forecast to forecast operational metrics for inventory management, and workforce and resource planning and management.

For example, you can use Amazon Forecast to forecast the following:

  • Retail product demand, such as the demand for products selling on a website or at a particular store or location
  • Supply chain demand including the quantity of raw goods, services, or other inputs needed by manufacturing
  • Resource requirements, such as the number of call center agents, contract workers, IT staff, and energy needed to meet demand
  • Operational metrics, such as web traffic to servers, AWS usage, or IoT sensor usage
  • Business metrics, such as cash flow, sales, profits, and expenses on a per-region or per-service basis

Amazon Forecast greatly simplifies building machine learning models. In addition to providing a set of predefined algorithms, Forecast provides an AutoML option for model training. AutoML automates complex machine learning tasks, such as algorithm selection, hyperparameter tuning, iterative modeling, and model assessment. Developers with no machine learning expertise can use the Amazon Forecast APIs, AWS Command Line Interface (AWS CLI), or Amazon Forecast console to import training data into one or more Amazon Forecast datasets, train predictors, and generate forecasts.

Amazon Forecast provides the following additional advantages:

  • Accuracy – Amazon Forecast uses deep neural net and traditional statistical methods for forecasting. When you have many related time series, forecasts made using the Amazon Forecast deep learning algorithms, such as DeepAR+ and NPTS, tend to be more accurate than forecasts made with traditional methods, such as exponential smoothing.
  • Usability – You can use theAmazon Forecast console to look up and visualize forecasts for any time series at different granularities. You can also see metrics for the accuracy of your forecasts.

How Amazon Forecast Works

When creating forecasting projects in Amazon Forecast, you work with the following resources:

  • Datasets and Dataset Groups – You create an Amazon Forecast dataset and import your training data. You create a dataset group and add related datasets. Amazon Forecast algorithms use your datasets to train custom forecasting models, called predictors.
  • Predictors – Predictors are custom models trained on your data. You can train a predictor by choosing a prebuilt algorithm (which includes the data featurization associated with the algorithm) or, by choosing the AutoML option, ask Amazon Forecast to pick the best algorithm for you.
  • Forecasts – You can generate forecasts for your time-series data and export the forecasts to your own Amazon Simple Storage Service (Amazon S3) bucket.

Datasets and Dataset Groups

Datasets provide data for training a predictor. You create one or more Amazon Forecast datasets, then import your training data to them. A dataset group is a collection of related datasets. After creating a dataset group and adding datasets to it, you use the dataset group to train a predictor. Each dataset group can accept 3 datasets, one of each type: TARGET_TIME_SERIES, RELATED_TIME_SERIES, and ITEM_METADATA.

To create and manage Amazon Forecast datasets and dataset groups, you can use the Amazon Forecast console, AWS Command Line Interface (AWS CLI), or AWS SDK.


A predictor is an Amazon Forecast trained model used for making forecasts based on time-series data. During training, Amazon Forecast generates accuracy metrics that you use to evaluate the predictor and decide whether to use the predictor to generate a forecast.

Creating Predictors

Amazon Forecast trains forecasting models called predictors. To create a predictor, you use the CreatePredictor operation.

To create a predictor, you provide the following:

  • A dataset group – Provides data for training the predictor.
  • A featurization configuration – Specifies the forecast frequency and provides information for transforming the data before model training. Data is transformed to make it more compatible with the training algorithm.
  • A forecast horizon – The number of time-steps to make. The forecast horizon is also called the prediction length.
  • Evaluation parameters – How to split a dataset into training and test datasets.
  • One of the following:
    • An algorithm – The algorithm is used to train a model and specifies default values for hyperparameter optimization (only DeepAR+), evaluation parameters, and training parameters. By specifying an algorithm, you also can provide overrides for these parameter values.
    • Perform AutoML – Amazon Forecast provides a set of predefined algorithms. If you don’t know which algorithm to choose, use the PerformAutoML option. This option tells Amazon Forecast to evaluate all algorithms and choose the best algorithm based on your datasets. With this option, model training can take longer, but you don’t need to worry about choosing the right algorithm and parameters. AutoML optimizes the average of the weighted P10, P50 and P90 quantile losses, and returns the algorithm with the lowest value.

For more information on algorithms, see Choosing an Amazon Forecast Algorithm.

Predictor Evaluation

After you create a predictor, you can evaluate the accuracy of the forecast it generates by running the GetAccuracyMetrics operation.

Evaluation Parameters

The evaluation parameters define how to split a dataset into training and test datasets for backtest window evaluations, as well as the number of backtest iterations to perform. These parameters have default values that can be overridden in the CreatePredictor request.

The evaluation parameters consist of the NumberOfBacktestWindows and theBackTestWindowOffset parameters.

NumberOfBacktestWindows specifies the number of times to split the input data. The range is 1 through 5.

BackTestWindowOffset defines the point from the end of the dataset where the data is split for model training and testing (evaluation). The value is specified as the number of data points. BackTestWindowOffset must be greater than or equal to the forecast horizon and less than half of the TARGET_TIME_SERIES dataset length. This parameter can be used to mimic a past virtual forecast start date.

For more information, see Predictor Metrics.


After creating an Amazon Forecast predictor, you call the CreateForecast operation to create a forecast. During forecast creation, Amazon Forecast trains a model on the entire dataset before hosting the model and doing inference. This operation creates a forecast for every item (item_id) in the dataset group that was used to train the predictor. After a forecast is created, you can query the forecast or export it to your Amazon Simple Storage Service (Amazon S3) bucket.

By default, the forecast frequency is the data collection frequency that you specified when you created the dataset with the CreateDataset operation. You can optionally specify an interval that is greater, but not lesser, than the specified frequency for the dataset. Then, the operation aggregates the forecast data and returns the results. For example, suppose that your data collection frequency was every day. You can then get a daily or monthly forecast, but not an hourly forecast.

You query a forecast using the QueryForecast operation. By default, the complete range of the forecast is returned. You can request a specific date range within the complete forecast.

When you query a forecast you must specify filtering criteria. A filter is a key-value pair. The key is one of the schema attribute names (including forecast dimensions) from one of the datasets used to create the forecast. The value is a valid values for the specified key. You can specify multiple key-value pairs. The returned forecast will only contain items that satisfy all the criteria.

To export the forecast, you can call the CreateForecastExportJob operation. This operation copies the forecast to your Amazon S3 bucket as a CSV file. Optionally, you can specify an AWS Key Management Service key to encrypt the data before it is written to the bucket.


Be sure to check out our AWS Forecast community