Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
david_serre
Product and Topic Expert
Product and Topic Expert
1,653

276270_276270_l_srgb_s_gl.jpg

Introduction

In a previous blog post, I explained how to perform a predictive what-if simulation using Predictive Planning. The workflow described was not ideal because it required to use the Predictive Planning user interface and creating a predictive model for each simulation scenario. Today, I will describe an improved workflow that makes the predictive what-if simulation simpler: it is centered on the story and requires only one predictive model.

This improvement is made possible thanks to the introduction in wave 2023.25 (QRC 2024.Q1) of two new actions to the predictive step of the multi actions:

  • Train Only allows to train a predictive model without writing the predictions.
  • Apply Only allows to apply an already trained predictive model without having to retrain it first.

If you are interested in an explanation about why you would want to introduce some predictive in your what-if simulation, please refer to the How Does Predictive Relates to What-if Simulation section in this other post.

Business Scenario

You are working for a company that rents bikes in London. You have a planning model that contains a BikeHires measure that counts the bike hires done each day. The planning model also contains several measures related to the weather. You know, thanks to Predictive Planning, that the weather has an influence on the number of daily bike hires: people tend to hire more bikes on a warm sunny day than on a rainy or chilly day.

You would like to perform simulations based on different weather hypotheses. In this blog post, you will learn how to setup a story and multi actions to compare different simulation scenarios as illustrated below:

Bike hires simulations.Bike hires simulations.

You can download this dataset if you want to recreate this example. Note that the columns BikeHires, Temp. Min, Temp. Max, Temp. Mean, Humid. Min, Humid. Max, Humid. Mean and Rain are expected to be measures in the planning model. Other columns should be considered dimensions. You can refer to this blog post if you need help to create a planning model from a CSV file.

In the rest of the post, we will assume that you are familiar with Predictive Planning and the influencers:

Step by Step

The Assets

To implement your what-if simulation in SAP Analytics Cloud you will need 3 assets:

  • A story: this will be your simulation workspace. This is where you will set up the simulation scenarios, run them and display the results.
  • A predictive scenario: you will create a predictive model that you will use to produce predictive forecasts.
  • One multi action: it will allow you to applying the predictive model to different sets of application data, that is, generating new predictions based on a specific simulation scenario.

The figure below shows these 3  assets in the SAP Analytic Cloud file system:

Simulation worfklow assets.Simulation worfklow assets.

You would usually create a second multi action allowing to retrain the predictive model, either manually from the story or automatically using a scheduled task in the calendar. For the sake of simplicity we will ignore this step and assume that the predictive model was retrained manually using the user interface of Smart Predict for instance.

The figure below shows the interaction between the assets involved in the simulation workflow:

Overview of the simulation workflow.Overview of the simulation workflow.

  1. The user clicks a trigger button in the story that trigger the multi action
  2. The multi action starts the application of the time series forecasting model.
  3. The time series forecasting model reads data from a "hypotheses" version in the planning model.
  4. The time series forecasting writes predictions to another version in the planning model.
  5. The predictions (results of the simulation) can be displayed in the story.

Creating a Predictive Model

First, you need a predictive model with influencers. The influencers are the parameters of the predictive simulation. They are the mean that enable you to influence the values predicted by the predictive model.

Create a predictive model and select Humid. Mean, Temp. Mean and Rain as candidate influencers:

Time serries forecasting model influencers configuration.Time serries forecasting model influencers configuration.

Because we want a simulation for 30 days in the future, set the Number of Forecast Periods to 30. The other model parameters are not fundamental in our scenario, for the sake of simplicity you can keep the default value for other parameters.

You can now train the predictive model and check in the Time Series Component Impact chart that Humid. Mean, Temp. Mean and Rain were selected as influencers and can be used to influence the simulation results.

Influencers impact.Influencers impact.

Creating the Application Multi Action

Now, you need a multi action to run the simulations. This multi action will contain an Apply Only action, that allows applying the underlying predictive model, that is, generating new predictions considering the future values of the influencers.

The Apply Only action takes two parameters:

  • Apply Model to Version: Here you must select a version that contains hypothetical future values of the influencers corresponding to the hypotheses of the simulation. This version is used as input for the predictive model application. It is advised to always create the planning versions corresponding to the simulation scenarios as copies of the planning version used to train the time series forecasting model and then provide future values for the influencers.
  • Save Forecast to Version: Here you must select the version where the predictions (the results of the what-if simulation) will be written.

Here are the steps to setup the Multi Action to apply the Predictive Model:

  • In SAP Analytics Cloud file system click the +Create button and select Multi Action.
  • In the multi action user interface, click the Add Predictive Step button in the toolbar.
  • In the Step Details panel, select the same predictive scenario and predictive model you have selected for the Train Only action.
  • Select Apply Only as predictive action.

Now you must select an input and an output version for the Apply Only action. To make things more flexible, we will use parameters so it is possible to select the versions in the story just before running a simulation. The multi actions now provide a shortcut that allows creating the parameters efficiently:

  • Just next to the Apply Model to Version field, click the Available Parameters button.
  • Click the Create Parameter option. This will automatically create a parameter ready to be used with the Apply Model Version setting.
  • Just change the parameter’s identifier , name, and description if you want to.
  • Click Done at the bottom of the panel.

Shortcut to create version parameters.Shortcut to create version parameters.

Do the same steps again for Save Forecast to Version setting.

The settings of the predictive step should look as shown below:

Predictive step configuration.Predictive step configuration.

Configuring the Story

Finally, you must add to a story one multi action trigger to retrain the predictive model and one to apply the predictive model. For each of the multi actions you have created previously follow these steps:

  • In the story toolbar, click the +Add > Planning Actions > Multi Action Trigger.
  • Select the multi action to be started by the multi action trigger.
  • Provide a label and description for the multi action trigger.

 Multi action trigger configuration (1/2).Multi action trigger configuration (1/2).

Multi action trigger configuration (2/2).Multi action trigger configuration (2/2).

Setting Up a Simulation Scenario

We are almost ready to run a simulation. But before we must create a version with simulation hypotheses and one to receive the simulation results:

  • Create the version with the hypothesis as a copy of the planning version that was used to train the predictive model (Use the Copy button then be sure the Copy all data option is selected).
  • Provide future values for the influencers in this version.
  • Create the version that will receive the simulation results as a blank version (Using the +Create Blank Public/Private Version button).

Do that for all the simulation scenarios you want to test.

Running a Simulation Scenario

Now it is time to run a simulation. Click the multi action trigger to run a simulation. Once you have configured the multi action and the multi action trigger as instructed, a dialog opens. In this dialog you must select a version with hypothetical future values for the influencers (the simulation hypotheses) and a version that will receive the predictions.

Running a simulation.Running a simulation.

It is recommended to use distinct planning versions for the hypotheses and the simulation results to avoid unexpected behaviors. At the very least, if you want to use the same version both for input and output be sure to delete any target value in the future before running the simulation (for instance you can add a data action cleaning step in to the multi action).

Click Run and wait for the data in the story to be updated.

david_serre_5-1706720549868.png

Conclusion

In this blog post you have discovered the new Apply Only and Train Only actions provided by the multi action's predictive step. You have learned how to use the Apply Only action to configure a multi action allowing to run predictive what if simulations.

I hope this blog post was helpful to you. If you appreciated reading this, I would be grateful if you left a comment to that effect, and do not forget to like it as well. Thank you.

Do you want to learn more about Predictive Planning? You can read our curated list of Predictive Planning and Smart Predict blog posts or you can read all our other blog posts.

Find all Q&A about SAP Analytics Cloud and feel free to ask your own question here: https://answers.sap.com/tags/67838200100800006884

Visit your community topic page to learn more about SAP Analytics Cloud: https://community.sap.com/topics/cloud-analytics/augmented-analytics