Skip to Content
Technical Articles
Author's profile photo Dhivakar L

Regression  Prediction Scenario in SAP Analytics Cloud

Introduction:

In this blog post, let’s see how to perform a Regression prediction scenario in SAP Analytics Cloud. The scenario chosen for this blog post is Profit Prediction of Startup companies. We are going to utilize the  ‘Smart Predict’ feature which is the most advanced predictive feature in SAC. 

To address prediction on different business use cases, there are three types of Smart Predict scenarios provided by SAC namely

  • Classification
  • Regression 
  • Time-Series 

Predictive%20Scenarios%20in%20SAP%20Analytics%20Cloud

Predictive Scenarios in SAP Analytics Cloud

After selecting the scenario, we train the predictive model by feeding historical data from our data source. SAC uses inbuilt machine learning algorithms to predict data from historical data. Predicted data can be saved in SAC models that can be consumed in stories and applications.

In our case, we are going to use the Regression scenario. Regression is used to estimate the value of a measure

Profit prediction of Startup Companies using SAC Regression Predictive Scenario:

The version of SAC used for carrying out the scenario is 2021.20. The data used for this scenario is the dataset of startup companies which is divided into training data and test data. In the dataset, records of 1000 companies are available out of which let’s take 900 records for the training dataset and the remaining 100 records for the test dataset.

Now, let’s dive into the step-by-step procedure.

1)Importing the training dataset 

In the dataset tab in SAC, import the training dataset by choosing the Excel/CSV file. In our case let’s name our training dataset as Startup.

Training%20Dataset

Training Dataset

2)Data Discovery

As we can see in the dataset overview pane, our dataset has 900 rows and 6 columns. There are 2 dimensions and 4 measures.

Let’s see a detailed description of all the columns.

ID: Unique ID of the startup companies

R&D Spend: It is the amount that the company is spending on Research & Development.

Administration: It is the amount that the company is spending for its administration.

Marketing Spend: It is the amount that the company is spending on Marketing.

State: It’s the place where the company began its initial operations.

 

3)Predictive Model Creation

Let’s create and compare predictive models to find the best predictive model to bring out better predictions. 

Open%20the%20Predictive%20Scenarios%20Application

Open the Predictive Scenarios Application

Let’s choose regression in predictive scenarios application.

Choose%20the%20regression%20scenario

Choose the regression scenario

Now let’s select our training dataset ‘Startup’ as data source and profit as target(numeric column containing the data to be predicted).

Predictive%20Model%20Training%20in%20SAC

Predictive Model Training in SAC

Now click on ‘Train’. Training is a process where SAC Smart predict uses machine learning algorithms to explore relationships in your data source to come up with the best combinations for the predictive model.

In a few seconds, our ‘Model 1’ has got trained. Now, it’s time to assess our predictive model.

Overview%20of%20the%20trained%20predictive%20model

Overview of the trained predictive model

The role of the Prediction Confidence is to measure if the predictive model can do the predictions with the same reliability when new cases arrive. In our model, the predictive confidence is 99.56% which is near perfect .

Target statistics provide the minimum, maximum, mean, and standard deviation of both the training and validation data.

During the training, Smart Predict calculates an optimized set of influencers to include in your predictive model. Influencers are the variables that actively have an impact on the target variable.

In our case Smart predict has calculated both R&D spend and Marketing spend as influencers out of which R&D Spend contributes the most with 91.88%.

Since the influence of marketing spend is so less compared to R&D spend, let’s train another model(Model 2) by excluding marketing spend as an influencer.

Excluding%20an%20influencer

Excluding an influencer

Comparing%20Model%201%20and%20Model%202

Comparing Model 1 and Model 2

Now we can see that there is not much difference between the prediction confidence of both the models and the predictions are going to be nearly the same.

Let’s check that by applying both models to our test data set.

4)Applying Predictive Model:

Let’s import our test dataset by importing the excel/CSV file. After importing let’s apply the predictive model to our test dataset in our predictive scenario application.

Applying%20predictive%20model%20on%20the%20test%20dataset

Applying predictive model on the test dataset

The output will be stored as a separate dataset where we can see the profit value predicted by our predictive model for the test dataset values.

Output%20Dataset%20of%20Model%201

Output Dataset of Model 1

Now following the same procedure let’s apply model 2 on our test dataset and compare the predicted values of both the models with the actual profit value of the records in our test dataset against each company ID.

Comparing%20Perfection%20%25%20of%20Model%201%20and%20Model%202

Comparing Perfection % of Model 1 and Model 2

The perfection percentage for each company is calculated by dividing the actual profit value by the Predicted value or vice versa. The overall Model perfection percentage is derived as the average perfection % of all the companies.

 As we mentioned earlier, there is not much difference between the perfection percentage of both models since the prediction confidence of both the models was nearly the same. When we look deep into the numbers we can make sure that model 1 will be the perfect predictive model to get better results with predictive confidence and perfection at 99.56% and 97.82% respectively.

Conclusion:

Hence our regression predictive model has predicted the profit of startup companies dataset with predictive confidence and perfection of 99.56% and 97.82% respectively. I hope that this blog post has really helped you in understanding regression predictive scenarios in SAP Analytics Cloud with a practical use case. Your ideas and suggestions are welcomed.

References:

https://blogs.sap.com/2020/08/13/regression-in-sap-analytics-cloud-in-detail/

Dataset Used:

https://drive.google.com/file/d/18G78U2Sb-twf4KCmW6gr5PaLCClYAOkH/view?usp=sharing

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Antoine CHABERT
      Antoine CHABERT

      Hello Dhivakar L  many thanks for creating the blog!

      Some suggestions & comments from my side, some of them similar to what I mentioned here:

      • Kindly share the dataset and/or mention data source you used for this example. This will help readers recreate & leverage your example.
      • suggesting you can add the custom tag Smart Predict and the standard tag SAP Analytics Cloud, augmented analytics so that it's easier for SAP community readers to find your blog (more below)
      • A quick comment on "In our model, the predictive confidence is 99.56% which is near perfect (above 80 is considered good)." Actually we do not have such confidence threshold. See the text in the help here: https://help.sap.com/viewer/00f68c2e08b941f081002fd3691d86a7/release/en-US/28f9cd2676314145b155d1a59a8e53ca.html. Quoting the help "Prediction Confidence takes a value between 0% and 100%. This value should be as close as possible to 100%."
      • Why not deepening the use case and and trying out the explanations feature? see https://blogs.sap.com/2021/07/22/prediction-explanations-for-regression-models-in-sap-analytics-cloud

      Again, thanks for sharing your content with the community!

      Kind regards

      Antoine Chabert (SAC Smart Predict product manager)

      Here the 54 Smart Predict blogs to date https://blogs.sap.com/tag/smart-predict/

      Here the 73 blogs related to SAC, augmented analytics https://blogs.sap.com/tags/2221d1b0-d759-4b24-9333-f72da4d263da/

       

       

      Author's profile photo Dhivakar L
      Dhivakar L
      Blog Post Author

      Hello Antoine CHABERT , Thanks for your suggestions, I have updated the blog post and the tags as you mentioned. Will soon try out the explanations feature ,Thank You.

      Author's profile photo Zainab Kaleem
      Zainab Kaleem

      Nice one,