

 Amazon Forecast 不再向新买家开放。Amazon Forecast 的现有客户可以继续照常使用该服务。[了解更多](https://aws.amazon.com/blogs/machine-learning/transition-your-amazon-forecast-usage-to-amazon-sagemaker-canvas/)

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用自动化 CloudFormation
<a name="tutorial-cloudformation"></a>

在本教程中，您将使用 AWS CloudFormation 自动化堆栈启动 Amazon Forecast 渠道并使用演示数据集生成预测。

Forec AWS ast CloudFormation 堆栈：
+ 部署 “使用 Machine Le [arning 提高预测准确性” 解决方案](https://docs.aws.amazon.com/solutions/latest/improving-forecast-accuracy-with-machine-learning/automated-deployment.html) CloudFormation 模板。
+ 将 [NYC 出租车数据集](https://registry.opendata.aws/nyc-tlc-trip-records-pds/)部署到 Forecast Data Amazon S3 存储桶。
+ 在 Forecast 中自动启动演示 NYC 出租车预测渠道。

该 CloudFormation 模板预加载了目标时间序列、相关时间序列和项目元数据演示数据集。控制台中的相关字段已预先填充各自的 S3 位置。

使用演示数据集完成本教程后，您可以使用相同的自动化堆栈生成基于您自己数据集的预测。

下图演示了本教程中使用的组件。

![\[AWS data pipeline for Amazon Forecast, showing data preparation, ingestion, forecasting, and evaluation stages.\]](http://docs.aws.amazon.com/zh_cn/forecast/latest/dg/images/cloudformationautomation-architecture.png)


## 先决条件
<a name="tutorial-cloudformation-prerequisites"></a>

在开始本教程之前，请确保您已登录 AWS 账户 并安装了 CloudFormation 模板：

1. 登录到你的 AWS 账户. 如果您还没有，请[创建一个 AWS 账户](https://aws.amazon.com/premiumsupport/knowledge-center/create-and-activate-aws-account/)。

1. 安装 AWS CloudFormation 模板。选择最靠近您的区域：
   +  东京：[ap-northeast-1](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template)
   +  首尔：[ap-northeast-2](https://console.aws.amazon.com/cloudformation/home?region=ap-northeast-2#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  孟买：[ap-south-1](https://console.aws.amazon.com/cloudformation/home?region=ap-south-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  新加坡：[ap-southeast-1](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  悉尼：[ap-southeast-2](https://console.aws.amazon.com/cloudformation/home?region=ap-southeast-2#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  法兰克福：[eu-cental-1](https://console.aws.amazon.com/cloudformation/home?region=eu-central-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  爱尔兰：[eu-west-1](https://console.aws.amazon.com/cloudformation/home?region=eu-west-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  弗吉尼亚州北部：[us-east-1](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  俄亥俄州：[us-east-2](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 
   +  俄勒冈州：[us-west-2](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=forecast-stack&templateURL=https:%2F%2Fs3.amazonaws.com%2Fsolutions-reference%2Fimproving-forecast-accuracy-with-machine-learning%2Flatest%2Fimproving-forecast-accuracy-with-machine-learning-demo.template) 

这将使用 [NYC 出租车数据集](https://registry.opendata.aws/nyc-tlc-trip-records-pds/)部署演示堆栈。

## 为 For CloudFormation ecast 自动化部署模板
<a name="tutorial-clouformation-steps"></a>

使用 NYC 出租车数据集部署 CloudFormation 模板

**步骤 1**：接受默认值，然后选择**下一步**。

![\[Create stack interface showing template options and Amazon S3 URL input field.\]](http://docs.aws.amazon.com/zh_cn/forecast/latest/dg/images/cloudformationautomation-step1.png)


**步骤 2**：提供通知的电子邮件地址，然后选择**下一步**。

![\[Datasets configuration form with URL fields for time series data and email input for forecast results.\]](http://docs.aws.amazon.com/zh_cn/forecast/latest/dg/images/cloudformationautomation-step2.png)


**步骤 3**：接受默认值并选择**下一步**。

**步骤 4**：在 “功能” 中，选中两个复选框 CloudFormation 以允许创建 AWS Identity and Access Management (IAM) 资源和嵌套堆栈。选择**创建堆栈**。

![\[Capabilities section with checkboxes for IAM resources and CloudFormation capability acknowledgments.\]](http://docs.aws.amazon.com/zh_cn/forecast/latest/dg/images/cloudformationautomation-step4.png)


您已在 Forecas CloudFormation t 中部署了一个模板。

## 清除
<a name="tutorial-clouformation-cleanup"></a>

部署此 CloudFormation 模板后，您可以清理新创建的资源，使用自己的数据集部署 CloudFormation 堆栈，并探索其他部署选项。
+ **清理**：删除演示堆栈会保留“使用机器学习提高预测准确性”堆栈。删除 “使用 Machine Learning 提高预测准确性” 堆栈会保留所有 S3、Athena 和 Forecas QuickSight t 数据。
+ **使用您自己的数据集**：要使用您自己的时间序列数据部署此 CloudFormation 模板，请在**步骤 2** 的 “数据集配置” 部分中输入数据集的 S3 位置。
+ **其他部署选项**：有关更多部署选项，请参阅[自动部署](https://docs.aws.amazon.com/solutions/latest/improving-forecast-accuracy-with-machine-learning/automated-deployment.html)。如果数据已经可用，则可以在没有演示数据的情况下部署堆栈。