Amazon Forecast
Developer Guide

This is prerelease documentation for a service in preview release. It is subject to change.

As of 6/6/19, Amazon Forecast no longer supports the following recipes: DeepAR, MDN, MLP, MQRNN, RFQR, and SQF. You can continue to use predictors created with these recipes to generate forecasts. However, you can’t use these recipes to create new predictors or to update existing predictors with new data. In addition, AutoML no longer considers these recipes. We’ve made these changes to ensure that Forecast offers the highest level of accuracy and robustness. We continue to support the ARIMA, DeepAR+, ETS, NPTS, and Prophet recipes.

Getting Started (Console)

In this exercise, you use the Amazon Forecast console to import time-series data of electricity usage, create an Amazon Forecast predictor based on the input dataset, and deploy the predictor to make predictions of future electricity usage based on the input time interval.

For this exercise, we use the individual household electric power consumption dataset. (Dua, D. and Karra Taniskidou, E. (2017). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.) We aggregate the usage data hourly.

Prerequisites: If you don't already have an AWS account, create one (as described in Sign Up for AWS), get your input data in place, and upload the data to your S3 bucket, as described in Prepare Input Data.

Step 1: Create a Dataset Group and Dataset

To import time-series data into Amazon Forecast, create a dataset group, choose a domain for your dataset group, specify the details of your data, and point Amazon Forecast to the S3 location of your data. You use a time series of historical electricity usage as an example for the target time-series data.

To create an Amazon Forecast dataset group and a dataset to import a time-series data for forecasting

  1. Sign in to the AWS Management Console and open the Amazon Forecast console at https://console.aws.amazon.com/forecast/.

  2. On the Amazon Forecast home page, if you haven't created any dataset groups, choose Create dataset group. If you've already created a dataset group, choose View dataset groups.

    If you aren't on the console's home page, choose Dataset groups from the navigation panel and then choose Create dataset group.

  3. On the Create dataset group page, for Dataset group details, provide the following information and then choose Next.

    • Dataset group name – Enter a name for your dataset group.

    • Forecasting domain – Choose Custom. For more information about how to choose a forecasting domain, see How Amazon Forecast Works and dataset domains and types.

    • IAM role – To use the IAM role that you created, choose Enter a custom IAM role ARN from the dropdown list, then enter the ARN of your IAM role in Custom IAM role ARN. Alternatively, you can have Amazon Forecast create the required IAM role for you by choosing Create a new role, and following the on-screen instructions. In this exercise, we have Amazon Forecast create the IAM role for us.

    Your screen should look similar to this:

  4. On the Import target time series data page

    1. For Target time series data import configuration, provide the following information:

      • Dataset name – Enter a name for your dataset.

      • Automatic dataset import jobs – For this example, choose Off to prevent updating the dataset with new time-series data in the S3 bucket.

      Your screen should look like this:

    2. For Target time series data formatting, provide the following information:

      • Frequency of your data – Specify 1 and choose hour(s). This setting must be consistent with the input time series data. The time interval in the sample electricity-usage data is an hour.

      • Timestamp format – Leave the default (yyyy-MM-dd HH:mm:ss). The format must be consistent with what's in the input time series data.

      • Delimiter – Leave the default (,). The sample electricity-usage data is a comma-separated (CSV) file.

      • CSV file headers – Choose Your .csv file doesn't have the required headers.

        Amazon Forecast then displays a Data schema template. If necessary, update the schema entries to match the columns of the time-series data in data types and order. For the electricity usage input data, the columns correspond to: a timestamp, the electricity usage at the specified time, and the ID of the customer charged for the electricity usage, in that order. Because headers are not defined in the input dataset, you must define a schema for this input data with the corresponding attribute names (timestamp, target_value, item_id) and the corresponding attribute types (timestamp, float, string), in that order.

      • Data location – Use the following format to enter the location of your .csv file on Amazon S3:

        s3://<name of your S3 bucket>/<folder path>/<CSV filename>

      Your screen should look similar to this:

  5. Choose Create dataset group and the dataset group's Dashboard page is displayed. Wait for the Amazon Forecast console to finish creating the dataset group, creating the dataset, and importing your time-series data. The process can take several minutes or longer to complete. You should see the status progress, starting with the following:

    When your dataset has been imported, you will see the following message:

    On the dataset group's Dashboard, the Target time series data status also transitions from Creating to Active.

    After your target time-series dataset has finished importing, you can train a predictor.

Step 2: Train a Predictor

To train a predictor, you use a recipe on the imported target time-series data. You can manually choose a particular recipe, or choose AutoML to have Amazon Forecast process your data and choose a recipe to best suit your dataset group. For information about recipes, see Choosing an Amazon Forecast Recipe.

To train a predictor

  1. On your dataset group's Dashboard, under Train a predictor, choose Start. The Train predictor page is displayed.

  2. On the Train predictor page, provide the following information for Predictor details:

    • Predictor name – Enter a name for your predictor.

    • Forecast horizon – Choose the number of forecasts to make. This number multiplied by the data entry frequency (hourly) that you specified in Step 1: Create a Dataset Group and Dataset determines how far into the future to make forecasts. For this exercise, set the number to 36, which will provide forecasts for 36 hours.

    • Recipe selection – Choose Manual and then choose the forecast_ets recipe from the drop-down menu. Alternatively, you can choose Automatic (AutoML) to let Amazon Forecast choose the recipe for you. For more information about recipes, see Choosing an Amazon Forecast Recipe.

    • Automatic retraining – Leave the default (Off) to disable automatic retraining. Because your input data won’t be updated, there’s no need to retrain your predictor.

    Your screen should look similar to the following:

  3. Choose Train predictor and then wait until training is finished. The process can take several minutes or longer to complete. You should see the status progress, starting with the following:

    On the dataset group's Dashboard, while the training is in progress, the status of Predictor training is Creating. When the training has finished, the status changes to Active.

    After your predictor has finished training, you can deploy it.

Step 3: Deploy the Predictor

After the predictor has finished training, you can deploy it and generate forecasts.

To deploy the predictor and generate forecasts

  1. On your dataset group's Dashboard, for Generate forecasts, choose Start. The Deploy predictor page is displayed.

  2. On the Deploy predictor page, for Predictor details, provide the following information:

    • Predictor – Choose the predictor you trained in the previous step from the drop-down menu.

    • Predictor version – No need to specify as there is only one version.

    • Automatic redeployment – For this exercise, choose Off. If you want to automatically redeploy this predictor on a regular schedule, choose On.

    Your screen should look similar to the following:

  3. Choose Deploy predictor and then wait for the deployment to finish. The process can take several minutes or longer to complete. While the deployment is in progress, the status of Forecast generation is Creating. When the deployment has finished, the status changes to Active. Don't proceed to the next step until the status is Active.

Step 4: Generate Forecasts

After the predictor has been deployed, you can generate and view forecasts for the items in your target time-series dataset.

To get and view your forecast

  1. On the Dashboard page, choose Lookup forecast under Generate forecasts. The Forecast lookup page is displayed. Alternatively, you can choose Forecast lookup from the navigation pane, under the dataset group that you created.

  2. On the Forecast lookup page, for Forecast details, provide the following information:

    • Item id – Enter a value from the item_id column of the input time series of the electricity usage data. An item_id (for example, client_21) identifies a particular client who is included in the dataset.

    • Predictor – Choose the predictor you previously deployed from the drop-down menu.

    • Predictor version – No need to specify as there is only one version.

    • Start date – Enter 2015-01-01.

    • End date – Enter 2015-01-03.

    • Time interval – Choose Hour from the drop-down menu.

    Your screen should look similar to the following:

  3. Choose Get Forecast and the forecast is displayed. Review the forecast for electricity usage demand by Client_21.

    Your forecast should look similar to the following: