When faced with the task of choosing the best, one can’t help but recall a famous movie scene that exemplifies the significance of decision making. In the film “Indiana Jones and the Last Crusade,” the adventurous archaeologist, Indiana Jones, is confronted with a room filled with a dazzling array of cups, only one of which is the Holy Grail. As he inspects his choice, he realizes that selecting the wrong cup would lead to dire consequences. And painstakingly examines each cup, weighing the potential outcomes. Likewise, supplier selection is crucial and challenging task for procurement department. Just like Indiana Jones, procurement team undergoes through time taking stressful process while supplier selection. However, Indiana jones after putting a lot of time and effort got successful with the right cup as Holy Grail. But usually, for procurement team it’s not the case even after mind spinning search they are uncertain about the ultimate choice. 

Well don’t worry! Introducing the Machine Learning Cockpit in SAP Business ByDesign! This predictive tool recommends you a supplier for new purchase order items. Just like how Indiana Jones selects Holy Grail based on his experience, The ML algorithm learns from the historical data of purchase orders that have been already ordered and enhances the Assign Source of Supply step for new purchase orders by providing Machine Learning proposal along with the confidence score that automates the supplier selection process. This thereby reduces the time to identify the right supplier to seconds and increase the chance of proper supplier selection based on past experiences, hence increasing efficiency. 

So, if you are interested in the most reliable purchasing experience then follow the step-by-step instructions. Because with the Machine Learning Cockpit on your side, you’ll be staying ahead of the competition. 

Prerequisites

You must have the authorization to access the following work center/ work center views: 

  • Business Analytics  
  • Machine Learning Cockpit 
  • Purchase Requests and Orders 

Step-by-Step Procedure

In this blog, we’ll go through all the steps to make predictions with the help of Purchase Order Item Details data source where predictions can be consumed in the General tab of Purchase Orders document. 

Now to give you an overview, firstly we’ll cover the creation of a scenario, which is a set of data and parameters that are used to create and train a machine learning model. 

Next, we’ll dive into the model building and training process. We’ll walk through the steps to create and train your own model, so you can get accurate predictions.  

Once you have your model, we’ll see how to create and execute a prediction run. This will allow you to see your model in action, making predictions based on your specific data.  

Finally, we’ll look at how to view your predictions in the Purchase Orders UI. This will give you a visual representation of your data, making it easy to understand and work with. By following these steps, you’ll have a comprehensive understanding of how to implement the solution end-to-end.  

So, let’s get started with steps to create a new Scenario in Machine Learning Cockpit. 

Scenario Management

To create a new scenario, navigate to the Machine Learning Cockpit work center and select the Scenario work center view. This is where you will find all the existing scenarios and be able to create new or edit existing ones 

Once you’re in the Scenario work center view, click the “New” button to create a new scenario. This will open a new window where you can enter the details for your new scenario. Name your scenario and make sure it starts with the letter Z, e.g., Z_PO_SUPPLIER_PROPOSAL, otherwise the tool will throw out an error as By Design has this rule for all user defined scenarios. 

You should now select the data source that you want to use for your scenario in the Data Source field. For this case select “Purchase Order Item Details” 

Then you must select the field that you want to predict in the Target Field section,” Supplier” in this case.  

Next, from the list of work center views, select the Work Center View ID. For example,” Purchase Orders”. If there are no work center views in the list, it means that there is either no report created for the “Purchase Order Item Details” data source or none of the reports have the work center view assigned.  

Moreover, under Input Field Selection, you should select the fields to be included in the training which may contribute to decide the outcome of Target field. I recommend selecting more fields in scenarios and decide about final selection in the model, based on data distribution statistics. Make sure to avoid fields that contain either ID or data from past years which is not helpful for new items, or which have data for only one outcome and null values for others and so on. You may refer Technical Specification | SAP Help Portal to read details about the fields for Purchase Order Item– Supplier Proposal use case.  

To restrict training data to items for which the business outcome is already known, add Filter Conditions. For this scenario, use Item Status= “Finished” and Item Type= Material; Service; Expense 

Also, to use dates as the features for model learning, Delivery Date From with “Categorical” Date Representation and “Quarter” “Month”, “Day”, “Day in a week” as date part in Date Part Split under Data Pre-processing Settings tab.

Finally, Save, Release, and Close the scenario. Your scenario should look something like the image below. 

Scenario

 That’s all. You have completed the first step and now your scenario is ready to have models built on it. Let’s go through the next section Model Management to understand how to build and train a model. 

Model Management

There are 3 sections here – model creation, data pre-processing and model training. Data pre-processing is a major step before model training. Raw data might contain many garbage values or no value at all which may lead to training failure or inefficient training and low accuracy. This is not what we want. 

 We will start by navigating to the Model work center view and selecting the ‘New’ button. At this point, under General Information tab, you will be prompted to enter information like the name and description of model, as well as the selection of the scenario that the model will be used for, Z_PO_SUPPLIER_PROPOSAL, in this case. Once you’ve entered this information, to load the data in the model, you will have to click Load Data button. I will suggest checking the number of rows and columns in the loaded dataset to ensure there is no anomaly. You are now all set to move to the next tab by clicking Next button. 

Model%20General%20Information

 As we move to the Filtering Data tab, you can see all the fields which we selected in scenario to be included in training. Now you have to decide which columns to keep based on the data distribution information provided, like removing the fields which contain load of null values. The tool will by default, mark the fields to be removed based on the default settings from scenario. I would suggest seeing the section Model – Filtering Data in the online Help Portal for details. Do make sure to check the number of rows and columns to ensure you don’t end up removing a larger portion of data. Click the Apply Filters button to perform the filtering operation. We will then move to Nulls Removal tab by selecting Next button. 

In Nulls Removal tab, we usually replace null values with -1 to avoid them influencing the model training. To do so, click on the Remove Nulls button. The status will then be updated to Nulls removed once the operation is performed. Selecting Next now will take us to Outliers Removal tab. 

 Outlier removal is a crucial part of ensuring that your data is accurate and will produce reliable results. When you get to the Outliers Removal tab, make sure you activate the checkbox “Activation of Outlier Removal” to start the operation. You’ll want to sort your table by the number of outliers so you can see which fields are causing the most problems. Keep an eye on fields with long-tail values, as they might be flagged as outliers even if they’re legitimate data points such as Product because there can be too many infrequently occurring values, which will be considered as outliers based on default threshold values. In case this leads to removal of too much data, try adjusting the threshold values of these fields. Remember Supplier field has long-tail distribution too. However, since it is a Target Field, we recommend keeping all values. This is the reason why it has Outlier Threshold value set by default to 0 

Select the “Remove Outliers” button to perform this operation. Just ensure that you click this button after each change to see how it affects your data. If you’re happy with the results, hit “Next” and move on to the next step. 

Don’t forget to check out the Model – Outliers Removal section in online Help Portal for more information. With a little tweaking, you can ensure that your data is clean and ready to be used in your models. 

 Finally, we are ready to train our model. In the Training Settings tab, you can see the algorithm our model will use for learning. This is preselected while creating scenario. However, if you are not satisfied with the training results and wish to try different algorithm, you must create a new scenario or copy existing one and change the algorithm. 

To start the training, select the Train button. Once the “Training in Progress” Status is shown, you can close the Model UI and check the model training status periodically in the Models work center view. 

 When model training is complete, you should check the Accuracy to determine the training quality. To see the extended model quality indicator, click the “Show Training Results” button and check Model Evaluation Indicators Per Class and Field Contributions. Just a tip, if you see failed training then check the error log by selecting the Results tab under “Show Log” link. 

You should now check whether the model quality is acceptable, or you want to retrain the model with different settings. Some of the parameter that can help you take that decision are Accuracy and F1 score for each class. More the merrier, but a score of 100% is always suspicious of overfitting. In case of acceptable model quality, select the Activate button to activate the model. 

Great job! Now our model is trained and tested. It’s the time to run predictions on unreleased outbound deliveries. Prediction Run Management section below explains that in detail. 

Prediction Run Management

This is the process for which we were preparing the data. To get started with Prediction Runs, you first need to create two extension fields in the Purchase Request or Purchase Order document UI:” Proposed Supplier” and “Prediction Probability”, in business context Items. My recommendation would be to use field type ‘Extended Text’ and ‘Decimal Number’ respectively. Later, these fields will be used to map the prediction results to be able to view them in the Purchase Order UI. You can read more about creating an extension field in SAP online Help portal. 

Once you’ve created these fields, navigate to Prediction Run and select New to create new prediction run. This is where you’ll set the name and scenario for your prediction, for e.g., Z_PO_SUPPLIER_PROPOSAL. Also, map the extension fields “Proposed Supplier” to Prediction Outcome and “Prediction Probability” to Prediction Probability: to the appropriate prediction outcomes. You’ll also want to add filter condition to restrict predictions to purchase requests that do not have supplier finalized yet for e.g., Item Status = “In Preparation” and Item Type = Material; Service; Expense 

Once your Prediction Run is set up, you can activate it and schedule the background job by selecting the Schedule button or run it directly by selecting Start Immediately button. Be sure to check the execution details periodically in Execution Details tab to ensure that the processing status is “Finished”. Once it is, you can check the execution status in the Application Log. You can also use the Prediction Results data source (MLSINFB) and filter by the scenario name you set earlier to see the results of your prediction. 

 That was it. All the production orders in status “Released” or “In Preparation” should now have a predicted business outcome assigned to them and the probability of that outcome being true. 

Now comes the exciting part – checking the prediction results! 

Prediction Consumption 

You did it! These predictions can be viewed in both business documents and Business Analytics. 

To view them in business documents, let’s move to Purchase Order work center viewSelect  purchase orders with Status “In Preparation” and go to Items. Voila! The extension fields Proposed Supplier and Prediction Probability now displays ML predicted supplier and how confident the model is about the prediction. 

In business analytics, you can consume predictions by navigating to the Prediction Results data source. This data source provides a list of all prediction scenarios in the form of Prediction Outcome, Prediction Probability, and key influencers. To view these predictions in the context of current scenario data, you will need to create a new join data source. You can do this by navigating to the Prediction Results data source, selecting “New -> Join Data Source”, entering a new name for the data source, for e.g., “Supplier Proposal” and selecting the Next button. You then select all the available fields before selecting Finish. Now switch to the Joined Data Sources tab and select the data source what you want to join Prediction Results by using Add option, “Purchase Order Item Details” in this case. In the Next tab, you should select the Key field in the Prediction Results data source and the Item UUID field in the Purchase Order Item Details data source. Create the join by selecting the Add button and move to the Next tab. Here, select all fields before finishing the process. Now, switch to Preview tab to make sure the join works, and finally Save and Close. This new join data source will provide you with a consolidated view of predictions for all in preparation and released production orders.

That’s how Machine Learning Cockpit can help by doing the analysis and prediction for you so that you can focus on important things like strategies, action items and customer relationship. 

Feel free to post your questions or share your experience in comments about this use case of Machine Learning Cockpit for SAP Business ByDesign.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x