Amazon Forecast is no longer available to new customers. Existing customers of
Amazon Forecast can continue to use the service as normal.
Learn more"
A what-if analysis is a tool to help investigate and explain how different scenarios might affect the baseline forecast created by Amazon Forecast. The baseline forecast is the forecast that is created by Amazon Forecast based on the original related time series that you provide.
A what-if analysis creates a series of what-if forecasts based on how you chose to modify the related time series. Those what-if forecasts are compared and contrasted with the baseline forecast to help you understand how specific changes might impact your model.
There are two methods for creating a modified related time series. You can either provide a modified related time series in an Amazon S3 path or specify a set of transformations to the existing related time series. When you specify a set of transformations, a copy of the original related time series is created to contain these changes.
The transformations allow you to create a subset of the related time series and modify specific attributes of the related time series. For more information, see Replacement Dataset and Transformation Functions.
Creating a what-if analysis
A what-if analysis explores how changes to the baseline related time series can impact a forecast. You can only create a what-if analysis from a forecast that uses an AutoPredictor. After you create a what-if analysis, you create one or more what-if forecasts. Compare the what-if forecasts and the baseline forecast, and then export one or more what-if forecasts.
Note
Your data must be in comma-separated values (CSV) format to create a what-if analysis.
Topics
Create a what-if analysis
You can create a what-if analysis using the Forecast console or the Forecast Software Development Kit (SDK).
To create a what-if analysis, complete the following steps:
-
Create a forecast that is trained using an AutoPredictor.
-
Open the dataset group dashboard that contains the forecast you're interested in.
-
Choose Explore what-if analysis.
-
On the What-if analysis tab of the Insights page, choose Create.
-
Provide a unique name in the What-if analysis name field and choose the baseline forecast for this analysis.
-
In the Item selection area, select whether you want to automatically include all items in the analysis or specify the items to include with a file.
If you choose Select items with file, you must provide a dataset that contains just the items that you want to modify in the what-if forecasts. For more information, see Specifying time series.
-
Choose Create what-if analysis. A banner at the top of the What-if Analysis page will display the status of the what-if analysis creation job.
Create a what-if forecast
You can create a what-if forecast using the Forecast console or the Forecast Software Development Kit (SDK).
To create a what-if forecast, complete the following steps:
-
On the What-if analysis tab of the Insights page, choose the what-if analysis that you are interested in.
-
In the What-if forecast section, choose Create.
-
On the Create what-if forecast page, provide a unique What-if forecast name and choose either Use transformation functions or Define the what-if forecast with a replacement dataset. For more information, see Replacement Dataset and Transformation Functions.
-
If you choose Use transformation functions, you must use the Transformation function builder to select and modify the rows that are included in the what-if forecast. All transformations are applied in the order they are specified. Conditions are applied in the order they are specified, and are joined with an AND operation. The transformation is applied only when all of the conditions are met.
-
If you choose Define the what-if forecast with a replacement dataset, you must provide a replacement dataset that contains only the rows that you want to change for the what-if forecast.
-
-
Choose Create.
Compare your what-if forecasts
To compare the what-if forecasts, complete the following steps in the Forecast console:
-
On the What-if analysis tab of the Insights page, choose the what-if analysis that you are interested in.
-
In the Compare what-if forecasts section, specify the item to analyze, one or more What-if forecasts, and at least one Forecast type.
In this example, there are two what-if forecasts,
priceCut10pct
andpriceIncrease20pct
, that are compared at thep50
,p10
, andp90
forecast types foritem_105
. The graph allows you to see how these forecasts compare against the baseline time series. -
Hover over the chart to investigate how the what-if forecasts compare to the baseline forecast.
Export your what-if forecasts
You can export a what-if forecast using the Forecast console or the Forecast Software Development Kit (SDK).
To export the what-if forecasts, complete the following steps:
-
On the What-if analysis tab of the Insights page, choose the what-if analysis that you are interested in.
-
In the What-if forecast export section, choose Create export.
-
On the Create what-if forecast export page, provide a unique What-if forecast export name, specify the What-if forecasts to include, choose an Export location, and provide the IAM role.
-
Choose Create export.
Query your what-if forecasts
You can query a what-if forecast using the QueryWhatIfForecast operation. By default, the complete range of the forecast is returned. You can request a specific date range within the complete forecast.
When you query a what-if forecast you must specify filtering criteria. A filter is a key-value pair. The key is one of the schema attribute names (including forecast dimensions) from one of the datasets used to create the forecast. The value is a valid values for the specified key. You can specify multiple key-value pairs. The returned what-if forecast will only contain items that satisfy all the criteria.
For example, use this code to get the what-if forecast for product_42
.
{
"Filters": {
"item_id" : "product_42"
},
"WhatIfForecastArn": "arn:aws:forecast:region:acctNumber:what-if-forecast/id1"
}