

 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\$1ids 不包含在假設分析中。  
類型：[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 Resource Name (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 Resource Name (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 Resource Name (ARN) 的資源。請檢查 ARN，然後再試一次。  
HTTP 狀態碼：400

## 另請參閱
<a name="API_CreateWhatIfForecast_SeeAlso"></a>

如需在其中一種語言特定 AWS SDKs中使用此 API 的詳細資訊，請參閱下列內容：
+  [AWS 命令列界面 V2](https://docs.aws.amazon.com/goto/cli2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 適用於 .NET V4 的 SDK](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 的 SDK v2](https://docs.aws.amazon.com/goto/SdkForGoV2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 適用於 Java V2 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 適用於 JavaScript V3 的 SDK](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 V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/forecast-2018-06-26/CreateWhatIfForecast) 
+  [AWS 適用於 Python 的 SDK](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) 