Skip to Content

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.

Confusion04_Multi.JPG

Disclaimer

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

Prerequisites

The dataset must include the actual and predicted classification.

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

Usage

These parameters can be set by the user.

Parameter Description
Actuals Name of categorical column that holds the actual classification.
Predictions Name 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.

Example

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.

Confusion01.JPG

The Confusion Matrix is configured as follows:

Confusion02_Config.JPG

And the confusion matrix itself:

Confusion03_Matrix.jpg

Disclaimer

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

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Marcel Garbers

    Hi Andreas,

    are you sure the zip-file is correct?

    I expected R code and a XML file. Instead I just get a cryptic txt file…

    thank you for sharing

    best regards

    Marcel

    (0) 
    1. Andreas Forster Post author

      Hi Marcel,

      Please rename the downloaded/extracted .txt file to zip. Then wihtin this zip file you get the R/XML files. SCN does not allow for attaching .zip files. So I had to use this workaround to upload the component anyway.

      Hope it will work. Cheers

      Andreas

      (0) 

Leave a Reply