

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

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

# CreateWhatIfForecast
<a name="API_CreateWhatIfForecast"></a>

假设分析预测是根据基准预测的修改版本创建的预测。每个假设分析预测都包含一个替换数据集或对原始数据集的一组转换。

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

## 请求语法
<a name="API_CreateWhatIfForecast_RequestSyntax"></a>

```
{
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ],
   "TimeSeriesReplacementsDataSource": { 
      "Format": "string",
      "S3Config": { 
         "KMSKeyArn": "string",
         "Path": "string",
         "RoleArn": "string"
      },
      "Schema": { 
         "Attributes": [ 
            { 
               "AttributeName": "string",
               "AttributeType": "string"
            }
         ]
      },
      "TimestampFormat": "string"
   },
   "TimeSeriesTransformations": [ 
      { 
         "Action": { 
            "AttributeName": "string",
            "Operation": "string",
            "Value": number
         },
         "TimeSeriesConditions": [ 
            { 
               "AttributeName": "string",
               "AttributeValue": "string",
               "Condition": "string"
            }
         ]
      }
   ],
   "WhatIfAnalysisArn": "string",
   "WhatIfForecastName": "string"
}
```

## 请求参数
<a name="API_CreateWhatIfForecast_RequestParameters"></a>

请求接受采用 JSON 格式的以下数据。

 ** [Tags](#API_CreateWhatIfForecast_RequestSyntax) **   <a name="forecast-CreateWhatIfForecast-request-Tags"></a>
适用于假设分析预测的[标签](https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html)列表。  
类型：[Tag](API_Tag.md) 对象数组  
数组成员：最少 0 个物品。最多 200 项。  
必需：否

 ** [TimeSeriesReplacementsDataSource](#API_CreateWhatIfForecast_RequestSyntax) **   <a name="forecast-CreateWhatIfForecast-request-TimeSeriesReplacementsDataSource"></a>
替换时间序列数据集，其中包含要在相关时间序列数据集中更改的行。替换时间序列不必包含与基准相关的时间序列中的所有行。仅包含您想要包含在假设分析预测中的行（度量维度组合）。  
此数据集与原始时间序列合并，以创建用于假设分析的转换数据集。  
此数据集应包含要修改的项目（例如 item\$1id 或 workforce\$1type）、任何相关维度、时间戳列以及至少一个相关时间序列列。此文件不应包含相同时间序列的重复时间戳。此文件必须采用 CSV 格式。  
未包含在此数据集中的时间戳和 item\$1id 不会包含在假设分析中。  
类型：[TimeSeriesReplacementsDataSource](API_TimeSeriesReplacementsDataSource.md) 对象  
必需：否

 ** [TimeSeriesTransformations](#API_CreateWhatIfForecast_RequestSyntax) **   <a name="forecast-CreateWhatIfForecast-request-TimeSeriesTransformations"></a>
应用于基准时间序列的转换。每个转换都包含一个操作和一组条件。仅当在满足所有条件时才会应用操作。如果未提供任何条件，则操作将应用于所有项目。  
类型：[TimeSeriesTransformation](API_TimeSeriesTransformation.md) 对象数组  
数组成员：最少 0 个物品。最多 30 项。  
必需：否

 ** [WhatIfAnalysisArn](#API_CreateWhatIfForecast_RequestSyntax) **   <a name="forecast-CreateWhatIfForecast-request-WhatIfAnalysisArn"></a>
假设分析的 Amazon 资源名称（ARN）。  
类型：字符串  
长度约束：最大长度为 256。  
模式：`arn:([a-z\d-]+):forecast:.*:.*:.+`  
是否必需：是

 ** [WhatIfForecastName](#API_CreateWhatIfForecast_RequestSyntax) **   <a name="forecast-CreateWhatIfForecast-request-WhatIfForecastName"></a>
假设分析预测的名称。每个假设分析中的名称必须唯一。  
类型：字符串  
长度限制：最小长度为 1。最大长度为 63。  
模式：`^[a-zA-Z][a-zA-Z0-9_]*`  
必需：是

## 响应语法
<a name="API_CreateWhatIfForecast_ResponseSyntax"></a>

```
{
   "WhatIfForecastArn": "string"
}
```

## 响应元素
<a name="API_CreateWhatIfForecast_ResponseElements"></a>

如果此操作成功，则该服务将会发送回 HTTP 200 响应。

服务以 JSON 格式返回以下数据。

 ** [WhatIfForecastArn](#API_CreateWhatIfForecast_ResponseSyntax) **   <a name="forecast-CreateWhatIfForecast-response-WhatIfForecastArn"></a>
假设分析预测的 Amazon 资源名称（ARN）。  
类型：字符串  
长度限制：最大长度为 300。  
模式：`arn:([a-z\d-]+):forecast:.*:.*:.+`

## 错误
<a name="API_CreateWhatIfForecast_Errors"></a>

 ** InvalidInputException **   
我们无法处理该请求，因为其包含无效值或超出有效范围的值。  
HTTP 状态代码：400

 ** LimitExceededException **   
超过了每个账户的资源数量限制。  
HTTP 状态代码：400

 ** ResourceAlreadyExistsException **   
已存在同名资源。请使用不同的名称重试。  
HTTP 状态代码：400

 ** ResourceInUseException **   
指定的资源正在使用中。  
HTTP 状态代码：400

 ** ResourceNotFoundException **   
我们找不到具有该 Amazon 资源名称（ARN）的资源。检查 ARN，然后重试。  
HTTP 状态代码：400

## 另请参阅
<a name="API_CreateWhatIfForecast_SeeAlso"></a>

有关以特定语言之一使用此 API 的更多信息 AWS SDKs，请参阅以下内容：
+  [AWS 命令行界面 V2](https://docs.aws.amazon.com/goto/cli2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于.NET 的 SDK V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 C\$1\$1 的 SDK](https://docs.aws.amazon.com/goto/SdkForCpp/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 Go v2 的 SDK](https://docs.aws.amazon.com/goto/SdkForGoV2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 Java 的 SDK V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS JavaScript V3 版软件开发工具包](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 Kotlin 的 SDK](https://docs.aws.amazon.com/goto/SdkForKotlin/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 PHP 的 SDK V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS Python 软件开发工具包](https://docs.aws.amazon.com/goto/boto3/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 适用于 Ruby V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/forecast-2018-06-26/CreateWhatIfForecast) 