Amazon Forecast - Developer Guide

[Pages:418]Amazon Forecast

Developer Guide

Amazon Forecast Developer Guide

Amazon Forecast: Developer Guide

Copyright ? Amazon Web Services, Inc. and/or its affiliates. All rights reserved. Amazon's trademarks and trade dress may not be used in connection with any product or service that is not Amazon's, in any manner that is likely to cause confusion among customers, or in any manner that disparages or discredits Amazon. All other trademarks not owned by Amazon are the property of their respective owners, who may or may not be affiliated with, connected to, or sponsored by Amazon.

Amazon Forecast Developer Guide

Table of Contents

What Is Amazon Forecast? .................................................................................................................. 1 Using Amazon Forecast ............................................................................................................... 2 Features of Amazon Forecast ....................................................................................................... 2 Pricing for Amazon Forecast ........................................................................................................ 2 Are You a First-Time User of Amazon Forecast? ............................................................................. 3

How Amazon Forecast Works ............................................................................................................... 4 Setting Up ........................................................................................................................................ 5

Sign Up for AWS ........................................................................................................................ 5 Set Up AWS CLI ......................................................................................................................... 5 Set Up Permissions .................................................................................................................... 6

Create an IAM Role for Amazon Forecast (IAM Console) ........................................................... 6 Create an IAM for Amazon Forecast (AWS CLI) ....................................................................... 8 Cross-service confused deputy prevention ........................................................................... 10 Getting Started ................................................................................................................................ 11 Prepare Input Data ................................................................................................................... 11 Getting Started (Console) .......................................................................................................... 12 Getting Started (AWS CLI) ......................................................................................................... 27 Getting Started (Python Notebooks) ........................................................................................... 36 Advanced Tutorials ........................................................................................................... 37 Clean Up Resources .................................................................................................................. 37 Tutorials .......................................................................................................................................... 39 Automating with AWS CloudFormation ....................................................................................... 39 Prerequisites .................................................................................................................... 41 Deploying an AWS CloudFormation Template for Forecast automation .................................... 41 Clean Up ......................................................................................................................... 44 Importing Datasets ........................................................................................................................... 45 Datasets .................................................................................................................................. 45 Dataset Domains and Dataset Types ................................................................................... 46 Dataset Schema ............................................................................................................... 47 Dataset Groups ........................................................................................................................ 48 Resolving Conflicts in Data Collection Frequency .......................................................................... 48 Time Boundaries .............................................................................................................. 49 Data Aggregation Guidelines .............................................................................................. 49 Related Time Series .................................................................................................................. 50 Historical and Forward-looking Related Time Series ............................................................. 50 Related Time Series Dataset Validation ............................................................................... 51 Example: Forward-looking Related Time Series File ............................................................... 51 Example: Forecasting Granularity ........................................................................................ 52 Legacy Predictors and Related Time Series ......................................................................... 53 Item Metadata ......................................................................................................................... 53 Example: Item Metadata File and Schema ........................................................................... 54 Legacy Predictors and Item Metadata ................................................................................. 55 See Also .......................................................................................................................... 55 Predefined Dataset Domains and Dataset Types ........................................................................... 55 RETAIL Domain ................................................................................................................ 57 CUSTOM Domain .............................................................................................................. 58 INVENTORY_PLANNING Domain ......................................................................................... 59 EC2 CAPACITY Domain ...................................................................................................... 60 WORK_FORCE Domain ...................................................................................................... 61 WEB_TRAFFIC Domain ...................................................................................................... 62 METRICS Domain .............................................................................................................. 63 Updating Data ......................................................................................................................... 63 Handling Missing Values ............................................................................................................ 64 Choosing Filling Logic ....................................................................................................... 64

iii

Amazon Forecast Developer Guide

Target Time Series and Related Time Series Filling Logic ....................................................... 65 Missing Value Syntax ........................................................................................................ 66 Dataset Guidelines .................................................................................................................... 67 Training Predictors ........................................................................................................................... 69 Creating a Predictor .................................................................................................................. 69 Upgrading to AutoPredictor ....................................................................................................... 71 Using additional datasets .......................................................................................................... 71 Working with legacy predictors .................................................................................................. 72 Predictor Metrics ...................................................................................................................... 73 Interpreting Accuracy Metrics ............................................................................................. 73 Weighted Quantile Loss (wQL) ........................................................................................... 74 Weighted Absolute Percentage Error (WAPE) ....................................................................... 75 Root Mean Square Error (RMSE) ......................................................................................... 76 Mean Absolute Percentage Error (MAPE) ............................................................................. 76 Mean Absolute Scaled Error (MASE) .................................................................................... 77 Exporting Accuracy Metrics ................................................................................................ 77 Choosing Forecast Types ................................................................................................... 79 Working With Legacy Predictors ......................................................................................... 81 Retraining Predictors ................................................................................................................ 84 Weather Index ........................................................................................................................ 85 Enabling the Weather Index ............................................................................................... 85 Adding Geolocation Information to Datasets ........................................................................ 86 Specifying Time Zones ...................................................................................................... 99 Conditions and Restrictions .............................................................................................. 104 Holidays Featurization ............................................................................................................. 105 Enabling the Holidays Featurization .................................................................................. 105 Country Codes ............................................................................................................... 106 Additional Holiday Calendars ........................................................................................... 108 Predictor Explainability ............................................................................................................ 109 Interpreting Impact Scores ............................................................................................... 109 Creating Predictor Explainability ....................................................................................... 110 Exporting Predictor Explainability ..................................................................................... 111 Restrictions and best practices ......................................................................................... 112 Forecast Algorithms ................................................................................................................ 113 Built-in Forecast Algorithms ............................................................................................. 113 Comparing Forecast Algorithms ........................................................................................ 114 ARIMA ........................................................................................................................... 115 CNN-QR ........................................................................................................................ 116 DeepAR+ ....................................................................................................................... 120 ETS ............................................................................................................................... 126 NPTS ............................................................................................................................. 127 Prophet ......................................................................................................................... 130 Generating Forecasts ....................................................................................................................... 131 Forecast Explainability ..................................................................................................................... 132 Interpreting Impact Scores ....................................................................................................... 132 Creating Forecast Explainability ................................................................................................ 133 Specifying time series ..................................................................................................... 133 Specifying time points .................................................................................................... 135 Visualizing Forecast Explainability ............................................................................................. 137 Exporting Forecast Explainability .............................................................................................. 137 Restrictions and best practices ................................................................................................. 138 Managing Resources ....................................................................................................................... 140 Stopping Resources ............................................................................................................... 140 Deleting Resources ................................................................................................................ 142 Understanding Resource Trees .......................................................................................... 142 Deleting Individual Resources ........................................................................................... 143 Deleting Resource Trees .................................................................................................. 144

iv

Amazon Forecast Developer Guide

Tagging Resources .................................................................................................................. 145 Managing Tags ............................................................................................................... 146 Using Tags in IAM Policies ............................................................................................... 146 Adding Tags to Resources ................................................................................................ 147 Additional Information .................................................................................................... 148

Receiving Notifications ............................................................................................................ 148 Monitoring Forecast Resource Jobs ................................................................................... 149 Creating an EventBridge Rule for Job Status Notifications .................................................... 150 Creating a CloudWatch Events Rule for Job Status Notifications ............................................ 150

Guidelines and Quotas .................................................................................................................... 151 Supported AWS Regions .......................................................................................................... 151 Compliance ............................................................................................................................ 151 Service Quotas ....................................................................................................................... 151

Reserved Field Names ..................................................................................................................... 154 Security ......................................................................................................................................... 174

Data Protection ...................................................................................................................... 174 Encryption at Rest .......................................................................................................... 175 Encryption in Transit ....................................................................................................... 175 Key Management ............................................................................................................ 175

Identity and Access Management .............................................................................................. 175 Audience ....................................................................................................................... 175 Authenticating With Identities .......................................................................................... 176 Managing Access Using Policies ........................................................................................ 178 How Amazon Forecast Works with IAM .............................................................................. 179 Identity-Based Policy Examples ........................................................................................ 182 Troubleshooting ............................................................................................................. 186

Logging and Monitoring .......................................................................................................... 188 Logging Forecast API Calls with AWS CloudTrail ................................................................. 188 CloudWatch Metrics for Amazon Forecast .......................................................................... 190

Compliance Validation ............................................................................................................. 191 Resilience .............................................................................................................................. 191 Infrastructure Security ............................................................................................................. 192 API Reference ................................................................................................................................. 193 Actions .................................................................................................................................. 193

Amazon Forecast Service ................................................................................................. 194 Amazon Forecast Query Service ....................................................................................... 335 Data Types ............................................................................................................................ 338 Amazon Forecast Service ................................................................................................. 339 Amazon Forecast Query Service ....................................................................................... 405 Common Errors ...................................................................................................................... 407 Common Parameters .............................................................................................................. 409 Document History .......................................................................................................................... 411 AWS glossary ................................................................................................................................. 413

v

Amazon Forecast Developer Guide

What Is Amazon Forecast?

Amazon Forecast is a fully managed service that uses statistical and machine learning algorithms to deliver highly accurate time-series forecasts. Based on the same technology used for time-series forecasting at , Forecast provides state-of-the-art algorithms to predict future time-series data based on historical data, and requires no machine learning experience. Time-series forecasting is useful in multiple fields, including retail, finance, logistics, and healthcare. You can also use Forecast to predict domain-specific metrics for your inventory, workforce, web traffic, server capacity, and finances.

For more information about the technical aspects of Amazon Forecast, see Time Series Forecasting Principles with Amazon Forecast.

1

Amazon Forecast Developer Guide Using Amazon Forecast

Topics ? Using Amazon Forecast (p. 2) ? Features of Amazon Forecast (p. 2) ? Pricing for Amazon Forecast (p. 2) ? Are You a First-Time User of Amazon Forecast? (p. 3)

Using Amazon Forecast

You can use the APIs (p. 193), AWS Command Line Interface (p. 27) (AWS CLI), Python Software Development Kit (p. 36) (SDK), and Amazon Forecast console (p. 12) to import time series datasets, train predictors, and generate forecasts.

Here are some common use cases for Amazon Forecast:

? Retail demand planning ? Predict product demand, allowing you to more accurately vary inventory and pricing at different store locations.

? Supply chain planning ? Predict the quantity of raw goods, services, or other inputs required by manufacturing.

? Resource planning ? Predict requirements for staffing, advertising, energy consumption, and server capacity.

? Operational planning ? Predict levels of web traffic, AWS usage, and IoT sensor usage.

Features of Amazon Forecast

Amazon Forecast automates much of the time-series forecasting process, enabling you to focus on preparing your datasets and interpretting your predictions.

Forecast provides the following features:

? Automated machine learning ? Forecast automates complex machine learning tasks by finding the optimal combination of machine learning algorithms for your datasets.

? State-of-the-art algorithms ? Apply a combination of machine learning algorithms that are based on the same technology used at . Forecast offers a wide range of training algorithms, from commonly used statistical methods to complex neural networks.

? Missing value support ? Forecast provides several filling methods to automatically handle missing values in your datasets.

? Additional built-in datasets ? Forecast can automatically incorporate built-in datasets to improve your model. These datasets are already feature engineered and do not require additional configuration.

Pricing for Amazon Forecast

With Amazon Forecast, you pay only for what you use. There are no minimum fees and no upfront commitments. The costs of Amazon Forecast depend on the number generated forecasts, data storage, and training hours.

The AWS Free Tier allows you a monthly limit of up to 10,000 time series forecasts, up to 10GB of storage, and up to 10 hours of training time. The Amazon Forecast free tier is valid for the first two months of usage.

2

Amazon Forecast Developer Guide Are You a First-Time User of Amazon Forecast? For a complete list of charges and prices, see Amazon Forecast pricing.

Are You a First-Time User of Amazon Forecast?

If you are a first-time user of Amazon Forecast, we recommend that you start with the following pages: 1. How Amazon Forecast Works (p. 4) ? Learn about the key concepts and the process of importing

datasets, creating predictors, and generating forecasts. 2. Getting Started (p. 11) ? Follow one of the tutorials to create your first Amazon Forecast

forecasting predictor. 3. API Reference (p. 193) ? Familiarize yourself with the Amazon Forecast API actions and data types.

3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download