Skip to main content

What-If Analysis with AutoML

Qlik AutoML is a powerful tool that makes it easy for analytics teams to generate models, make predictions and test business scenarios without having to write code.

We utilise the power of the Qlik Server-Side Extension (SSE) to create a simple dashboard for scenario analysis directly in Qlik Sense.

💡 Note: "What-if" scenarios are a great way to plan decisions and actions by testing different parameters using AutoML's prediction API.

What is SSE?

The Server-Side Extension (SSE) protocol allows us to extend Qlik's built-in expression library with functions from external calculation programmes. In our case, we will use AutoML's recalculation of the prediction based on variable changes to display the result in a KPI chart.

Example

Let's walk through the process using a practical example. We will look at the risk of employee turnover (data set at the end of the article).

1. Create your AutoML project and load the data set

  • Make sure that you select the "left" field as the target.
  • Once you have successfully completed the training process, deploy your model and enable API access.

📝 Write down: Make a note of the access URL and token as we will need these to establish the connection in Qlik Sense.

Screenshot of Qlik AutoML analyzing
Screenshot of Qlik AutoML analyzing
Screenshot of Prediciton API Access
Screenshot of Prediciton API Access

 

2. Create a new data connection in our QS tenant via the "Qlik AutoML" Analytics source connector

  • If you don't see it, make sure you enable machine learning endpoints in the Management Console.

    Where to Click in the "Create new connection" window
    Where to Click in the "Create new connection" window
    Create a new connection Form
    Create a new connection Form

     

3. Create a scenario analysis sheet in the Qlik Sense app

  1. Create the variables that are used in the "Variable Input" objects.

    • Focus on the features that are more important according to the feature importance table.
      Table of Variables
      Table of Variables
  2. Create the objects.

    • The KPI that shows the likelihood of employees leaving is based on a measure that uses the SSE expression below, with some of the characteristics passed as variables.

    ⚠️ Important: Note that the first argument of ScriptEvalEx must match the field types of our features - where N is a number and S is a string. In addition, the features passed as the third argument must match AutoML 1 to 1; missing features will result in an error.

    =endpoints.ScriptEvalEx('NNNNNNNSS','{"RequestType":"endpoint", "endpoint":{"connectionname":"Qlik_AutoML_Employee_Turnover","column":"probability_yes"}}',

vSatisfactionLevel AS satisfaction_level,
last_evaluation,
vNumberOfProjects AS number_project,
vAvgMonthlyHoursWorked AS average_monthly_hours,
vTimeSpent AS time_spend_company,
Work_accident,
promotion_last_5years,
vDepartment AS sales,
vSalary AS salary)

 

  1. Create our variable inputs using the Variable Input chart under Custom Objects > Qlik Dashboard Bundle. Customise the "Display as" type as required.
Screenshot of the Worksheet, where to find Variable Input and change the Name
Screenshot of the Worksheet, where to find Variable Input and change the Name

You can now customise the variables to trigger AutoML, which will automatically redistribute the data and re-predict the outcome to understand the impact of possible actions.