Amazon Forecast - Developer Guide

[Pages:420]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) ......................................................................................................... 21 Getting Started (Python Notebooks) ........................................................................................... 30 Advanced Tutorials ........................................................................................................... 31 Clean Up Resources .................................................................................................................. 31 Tutorials .......................................................................................................................................... 33 Automating with AWS CloudFormation ....................................................................................... 33 Prerequisites .................................................................................................................... 35 Deploying an AWS CloudFormation Template for Forecast automation .................................... 35 Clean Up ......................................................................................................................... 38 Importing Datasets ........................................................................................................................... 39 Datasets .................................................................................................................................. 39 Dataset Domains and Dataset Types ................................................................................... 40 Dataset Schema ............................................................................................................... 41 Dataset Groups ........................................................................................................................ 42 Resolving Conflicts in Data Collection Frequency .......................................................................... 42 Time Boundaries .............................................................................................................. 43 Data Aggregation Guidelines .............................................................................................. 43 Related Time Series .................................................................................................................. 44 Historical and Forward-looking Related Time Series ............................................................. 44 Related Time Series Dataset Validation ............................................................................... 45 Example: Forward-looking Related Time Series File ............................................................... 45 Example: Forecasting Granularity ........................................................................................ 46 Legacy Predictors and Related Time Series ......................................................................... 47 Item Metadata ......................................................................................................................... 47 Example: Item Metadata File and Schema ........................................................................... 48 Legacy Predictors and Item Metadata ................................................................................. 49 See Also .......................................................................................................................... 49 Predefined Dataset Domains and Dataset Types ........................................................................... 49 RETAIL Domain ................................................................................................................ 51 CUSTOM Domain .............................................................................................................. 52 INVENTORY_PLANNING Domain ......................................................................................... 53 EC2 CAPACITY Domain ...................................................................................................... 54 WORK_FORCE Domain ...................................................................................................... 55 WEB_TRAFFIC Domain ...................................................................................................... 56 METRICS Domain .............................................................................................................. 57 Updating Data ......................................................................................................................... 57 Handling Missing Values ............................................................................................................ 58 Choosing Filling Logic ....................................................................................................... 58

iii

Amazon Forecast Developer Guide

Target Time Series and Related Time Series Filling Logic ....................................................... 59 Missing Value Syntax ........................................................................................................ 60 Dataset Guidelines .................................................................................................................... 61 Training Predictors ........................................................................................................................... 63 Creating a Predictor .................................................................................................................. 63 Upgrading to AutoPredictor ....................................................................................................... 65 Using additional datasets .......................................................................................................... 66 Working with legacy predictors .................................................................................................. 66 Predictor Metrics ...................................................................................................................... 67 Interpreting Accuracy Metrics ............................................................................................. 68 Weighted Quantile Loss (wQL) ........................................................................................... 68 Weighted Absolute Percentage Error (WAPE) ....................................................................... 70 Root Mean Square Error (RMSE) ......................................................................................... 70 Mean Absolute Percentage Error (MAPE) ............................................................................. 71 Mean Absolute Scaled Error (MASE) .................................................................................... 71 Exporting Accuracy Metrics ................................................................................................ 72 Choosing Forecast Types ................................................................................................... 73 Working With Legacy Predictors ......................................................................................... 75 Retraining Predictors ................................................................................................................ 78 Weather Index ........................................................................................................................ 79 Enabling the Weather Index ............................................................................................... 79 Adding Geolocation Information to Datasets ........................................................................ 80 Specifying Time Zones ...................................................................................................... 93 Conditions and Restrictions ............................................................................................... 98 Holidays Featurization ............................................................................................................... 99 Enabling the Holidays Featurization .................................................................................... 99 Country Codes ............................................................................................................... 100 Additional Holiday Calendars ........................................................................................... 102 Predictor Explainability ............................................................................................................ 103 Interpreting Impact Scores ............................................................................................... 103 Creating Predictor Explainability ....................................................................................... 104 Exporting Predictor Explainability ..................................................................................... 106 Restrictions and best practices ......................................................................................... 107 Forecast Algorithms ................................................................................................................ 107 Built-in Forecast Algorithms ............................................................................................. 107 Comparing Forecast Algorithms ........................................................................................ 108 ARIMA ........................................................................................................................... 109 CNN-QR ........................................................................................................................ 110 DeepAR+ ....................................................................................................................... 115 ETS ............................................................................................................................... 121 NPTS ............................................................................................................................. 122 Prophet ......................................................................................................................... 125 Generating Forecasts ....................................................................................................................... 126 Creating a forecast ................................................................................................................. 126 Exporting a forecast ............................................................................................................... 127 Querying a forecast ................................................................................................................ 129 Forecast Explainability ..................................................................................................................... 130 Interpreting Impact Scores ....................................................................................................... 130 Creating Forecast Explainability ................................................................................................ 131 Specifying time series ..................................................................................................... 132 Specifying time points .................................................................................................... 133 Visualizing Forecast Explainability ............................................................................................. 135 Exporting Forecast Explainability .............................................................................................. 135 Restrictions and best practices ................................................................................................. 136 Managing Resources ....................................................................................................................... 138 Stopping Resources ............................................................................................................... 138 Deleting Resources ................................................................................................................ 140

iv

Amazon Forecast Developer Guide

Understanding Resource Trees .......................................................................................... 140 Deleting Individual Resources ........................................................................................... 141 Deleting Resource Trees .................................................................................................. 142 Tagging Resources .................................................................................................................. 143 Managing Tags ............................................................................................................... 144 Using Tags in IAM Policies ............................................................................................... 144 Adding Tags to Resources ................................................................................................ 145 Additional Information .................................................................................................... 146 Receiving Notifications ............................................................................................................ 146 Monitoring Forecast Resource Jobs ................................................................................... 147 Creating an EventBridge Rule for Job Status Notifications .................................................... 148 Creating a CloudWatch Events Rule for Job Status Notifications ............................................ 148 Guidelines and Quotas .................................................................................................................... 149 Supported AWS Regions .......................................................................................................... 149 Compliance ............................................................................................................................ 149 Service Quotas ....................................................................................................................... 149 Reserved Field Names ..................................................................................................................... 153 Security ......................................................................................................................................... 173 Data Protection ...................................................................................................................... 173 Encryption at Rest .......................................................................................................... 174 Encryption in Transit ....................................................................................................... 174 Key Management ............................................................................................................ 174 Identity and Access Management .............................................................................................. 174 Audience ....................................................................................................................... 174 Authenticating With Identities .......................................................................................... 175 Managing Access Using Policies ........................................................................................ 177 How Amazon Forecast Works with IAM .............................................................................. 178 Identity-Based Policy Examples ........................................................................................ 181 Troubleshooting ............................................................................................................. 185 Logging and Monitoring .......................................................................................................... 187 Logging Forecast API Calls with AWS CloudTrail ................................................................. 187 CloudWatch Metrics for Amazon Forecast .......................................................................... 189 Compliance Validation ............................................................................................................. 190 Resilience .............................................................................................................................. 190 Infrastructure Security ............................................................................................................. 191 VPC endpoints (AWS PrivateLink) ............................................................................................. 191 Considerations for Forecast VPC endpoints ........................................................................ 191 Creating an interface VPC endpoint for Forecast ................................................................. 192 Creating a VPC endpoint policy for Forecast ...................................................................... 192 API Reference ................................................................................................................................. 194 Actions .................................................................................................................................. 194 Amazon Forecast Service ................................................................................................. 195 Amazon Forecast Query Service ....................................................................................... 337 Data Types ............................................................................................................................ 340 Amazon Forecast Service ................................................................................................. 341 Amazon Forecast Query Service ....................................................................................... 407 Common Errors ...................................................................................................................... 409 Common Parameters .............................................................................................................. 411 Document History .......................................................................................................................... 413 AWS glossary ................................................................................................................................. 415

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. 194), AWS Command Line Interface (p. 21) (AWS CLI), Python Software Development Kit (p. 30) (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. 194) ? 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