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.
Showing results for 
Search instead for 
Did you mean: 
Product and Topic Expert
Product and Topic Expert
0 Kudos

This component extends the capabilities of SAP Predictive Analysis and adds an stand-alone confusion matrix. Such a chart can be helpful to understand the strength of a classification model.

Out-of-the box SAP Predictive Analysis already displays a confusion matrix for the data the model was trained on. However, to understand the quality of a model, it is also important to verify the model against data that was not used to create the model in the first place. You can use this Custom R Component for that purpose. You can also use it to visualise the predictions of other classification methods you might have added yourself to the SAP Predictive Analysis framework.


Please note that this component is provided as-is without any guarantee or support.


The dataset must include the actual and predicted classification.

The R-libraries caret, lattice and ggplot2 have to be installed.


These parameters can be set by the user.

ActualsName of categorical column that holds the actual classification.
PredictionsName of categorical column that holds the predicted classification.

Output Columns: Unchanged input data.

How to Implement

The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option "Import/Model Component", which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.


In this analysis the Confusion Matrix is used to display how accurately a trained decision tree predicts the classification on some test data, for which the actual classification is already known.

The Confusion Matrix is configured as follows:

And the confusion matrix itself:


Please note that this component is provided as-is without any guarantee or support.