cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding Variables to Predictive Analysis

Ganjos
Participant

Accepted Solutions (1)

Accepted Solutions (1)

david_serre
Product and Topic Expert
Product and Topic Expert

Hi,

The short answer to your question is, yes, it is possible to add external variables to influence the forecast result. The exact way to do it depends on the precise functionally you are using to produce the forecast in SAP Analytics cloud. I will cover both cases.

One very important thing to note, that applies in all the cases mentioned below: if you want to use influencers (variables that influence the output of the forecast) you must be able provide influencers values for the whole forecast period. Let's assume that the tuition price influences the enrollments (as suggested in this post). The predictive model will be able to detect the correlation between the past tuition price and the number of enrollments but to produce a prediction for year 2025, the predictive model will need to know the expected tuition price in 2025 (for each school obviously). 

The explanation provided below uses examples based on bike hires in London: these examples involve only one time series but everything works the same for several time series (bike hire in several cities, or enrollments in 3 schools for instance).

I - In story forecast

If you have simple forecasting needs, you can rely on the forecast features integrated in stories. By simple I mean: you only have a small number of distinct time series to forecast (up to 10) and you don't care about evaluating the forecast quality or getting detailed insights about the forecasted time series (trend, cycles, impact of the influencers...). 

There are two distinct forecasting features integrated in stories:

  • Forecast in Time Series Chart (can leverage influencers)
  • Forecast in Planning Table (cannot leverage influencers)

Only Forecast in Time Series Chart allows leveraging influencers.

Currently forecast in planning table is not available in ODE.

How to leverage influencers (aka additional inputs, external factors...) in Forecast in Time Series:

In a "old story" you can enable time series forecasting using the contextual menu as shown below:

david_serre_3-1732267013058.png

By default, you will get a forecast based on temporal factors only (trend, cycles...).

david_serre_0-1732266854054.png

Note that you can forecast up to 10 time series this way in a single chart.

To leverage external factors (aka additional inputs or influencers) you must use the advanced options as shown below:

david_serre_4-1732267234261.png

Add settings panel will open to the right. In this panel you can use the Add Additional Input link to select influencers. Click Apply at the bottom of the panel to validate the new settings. 

Note that you can only select numerical values (measures or account) as influencer.

david_serre_5-1732267387897.png

As you can see below the forecast is improved by adding the additional input.

However, if the measure/account you use as additional input doesn't increase significantly the forecast accuracy it will be ignored. You cannot force the predictive model to use an influencer that is actually not correlated to the target. 

david_serre_2-1732266975117.png

User experience is a little bit different in a optimized design experience story, but overall the principle remains the same.

II - Predictive Planning (Smart Predict for planning models)

If you have more advanced predictive needs you may want to use Smart Predict instead of the predictive features integrated in stories. Smart Predict is an automated predictive environment with a more complete set of capabilities.

Important Smart Predict capabilities:

  • Segmented modeling: you can forecast up to 1000 distinct time series (aka "entities") with a single predictive model (meaning enrollment for 1000 schools in you use case).
  • Smart Predict provides forecast configuration options better fit specific forecasting needs.
  • In Smart Predict you can evaluate the forecast accuracy of your predictive model using standard quality indicators.
  • In Smart Predict  you get modeling reports allowing to analyze trends, cycles (periodicities and seasonalities) and the impact of the influencers.

If you need to produce forecast on a regular basis, Smart Predict can be scheduled using Multi Actions and SAC Calendar.

In this answer I will focus on the influencers exclusively, but if you need more information about using Smart Predict, you can refer to the following post: https://community.sap.com/t5/technology-blogs-by-sap/one-predictive-planning-amp-smart-predict-blog-...

Finally, note that "Smart Predict" is the generic name of the feature for creating predictive models in SAC, but is sometimes referred to as "Predictive Planning" when it is used to perform time series forecasting using planning models.

If you don't use influencer, you get the following forecast in Smart Predict:

david_serre_6-1732270458983.png

You can add influencers using the Add Influencer link in the Influencers section of the predictive model setting:

david_serre_7-1732270589636.png

Like previously the forecast is improved by adding the influencer:

david_serre_8-1732270668773.png

In Smart Predict you can easily compare the two predictive models and see that the prediction error (Mean Absolute Percentage Error and Mean Absolute Error) is lower when influencers are used:

david_serre_9-1732270949521.png

You can also see how the influencers impact the predicted target. The impact of rain on the bike hires is very straight forward, the more rain the fewer bike hires, as illustrated below:

david_serre_10-1732271094209.png

Best Regards

Ganjos
Participant
0 Likes
Hi! Thanks for your response; it really helped me understand the influencers. I have a question: in a model I’m developing, I can’t create more than one forecast. Do you know of any resources or links that could help me improve model creation for forecasts?
david_serre
Product and Topic Expert
Product and Topic Expert

Hi Ganjos,

What feature are you using to create your forecast? Smart Predict or forecast in chart?

Both have very different options and limitations.

Best,

 

Ganjos
Participant
0 Likes
Hi, I'm using forecast in chart
david_serre
Product and Topic Expert
Product and Topic Expert

Hi,

I assume that by " I can’t create more than one forecast", you mean that it's not possible to get more than one future forecast point (named "forecast periods" in the user interface).

The number of forecast period is limited by the number of available past points. If you want to increase the number of forecast periods, you need to get more past data points.

This has to do with the prediction interval (the blue shaded area around the forecast that informs you about the prediction uncertainty). Forecast in chart provides a prediction only if it's able to provide a prediction interval along with the prediction. The future in the future the prediction, the more past data points are need to calculate the prediction interval. 

Regards,

Ganjos
Participant
0 Likes

Thanks for the answer.  I created an example where I included more past dates. However, I encountered the following message: "Dotacoes_corrigidas is not considered in the forecast due to a lack of future values for dotacoes_corrigidas_acumuladas." Now, I’m able to predict more than one forecast period, but the additional variable I’m adding is still not being considered. Thanks in advance Ganjos

david_serre
Product and Topic Expert
Product and Topic Expert

Hi Ganjos,

You must provide future values for all the influencer, for all schools and over the whole forecast horizon.

What do I call past and future? Past and future is defined by the last available data point for the target. Referring to the example below, the last available value for BikeHires (the measure we want to predict) is on August 25, 2015. This implies that any later date is "the future". The predictions will start on  August 26, 2015.

david_serre_3-1732553487611.png

This means that if you want to forecast using Temp. Mean and Rain as influencer, you must provide values for Temp. Mean and Rain starting from August 26, 2015 tup to the date of the last prediction.

In the example above it would be possible to get 6 forecast periods (August 26 to August 31) for the City Center area using Temp. Max and Rain as influencers. For the North area, it would be possible to get only 2 forecast periods as the Temp. Mean and Rain are available only for the next 2 days. 

Note that by default, forecast in table tries to predict as many point as allowed by the number of past data points. As you must provide future values for the whole forecast horizon,  you may want to reduce the number of forecast period using the Forecast Periods option in the advanced options:

david_serre_2-1732553250639.png

Best,

 

Ganjos
Participant
0 Likes
Hi, in your example, how would you add an entire month, such as September? Regarding granularity, would you choose "Month-Year" or just "Year"? This is a question I have since I'm relatively new to forecasting, and I can't seem to find information on how to create a proper module for forecasting.
david_serre
Product and Topic Expert
Product and Topic Expert

Hi,

Forecast In Chart always uses the data as displayed in the chart.

In my example since data is displayed at the day granularity, data is processed at the day granularity and forecast is provided at the day granularity. If I want to get a forecast for the whole month I must request a 30 periods forecast, I will get 30 predictions corresponding to 30 days:

david_serre_0-1732701973672.png

(Date hierarchy level is set to "day")

If I want to work at a month level I just have to change the chart configuration and display the data aggregated by month. In that case data is processed at the month level, and 1 period forecast corresponds to a 1 months forecast (1 predictions for one month):

david_serre_1-1732702275537.png

(Date hierarchy level is set to "month")

Choosing the right time granularity is first a matter of how you want to consume the forecast. If you are interested in consuming the predicted value at the month level, then it's better to forecast at the month level directly than forecasting at the day level and then summing the result (because you are also summing the prediction error). 

Regards.

Ganjos
Participant
0 Likes
Hi, thank you for your help! I think I’m starting to understand this part of forecasting now.

Answers (0)