Analysing AI models from Einstein discovery in Tableau
Einstein is an intuitive tool in the Salesforce CRM that aims to facilitate AI-driven decision making. Tableau is a data visualisation and analytics tool, also part of the Salesforce family. In this article, we will show how to use Tableau to visualise and extract insights from an AI model created in Einstein.
Since the 2021.1 release of Tableau, Einstein is now available as a Tableau extension that can be integrated into a Tableau dashboard. We will go through an example and implement this extention by using a predictive model already created in Einstein. If you have not already done so, you can learn more about the process and create your own model in Einstein by reading our dedicated article.
The model that we have trained in Einstein discovery uses example dataset from a fictitious company that offers a music streaming service, with a free and as well as a premium subscription.
As shown in the example below, the data collected by this company are:
· The canton of residence of the customer
· If the person is an existing customer or a new one acquired via the promotion
· If the person is registred to receive the newsletter
· Whether or not the customer has decided to switch to the premium service after the 3 months trial
The goal of the predictive model that we have already setup in Einstein discovery, is to maximise the variable “Conversion” with the value “Yes”. For the purposes of the demo, we have selected "Newsletter" as the actionable variable in the model. This means that we can decide whether or not to send promotions to customers via the newsletter to see if it impacts their decision.
In order to use this model in Tableau, we will open Tableau Desktop and connect to the same data that we used to train the predictive model in Einstein. Before building a dashboard in Tableau with the Einstein extension, we have to create a worksheet where all variables used in the model are in Detail in the Marks pane like this :
Then, this worksheet has to be on the dashboard to implement Einstein. But, since it is not needed in the visualization, put it as a floating object with width 1px and height 1px on a corner of the dashboard.
Everything is now setup. From the bottom left pane, we will drag an extension object into the dashboard and look for Einstein Discovery.
We will be asked to enter the credentials obtained by creating a Trailhead Developer account as explained in this article. Select the model created in Salesforces Tableau CRM and the worksheet used to drive Einstein Discovery. Fields will be mapped between the model and the dashboard.
We will choose a label for our prediction and the unit score. The main parameters to be configured are Top predictors and improvements. The first one will display the number of predictors that impact the most the prediction while the second will display the best changes that we can do to improve the prediction.
In our model, we can influence only one variable (Newsletter) and in only one way (from registered to not registered or conversely) so only 1 top improvement can be displayed.
The model is now successfully deployed in Tableau!
Interpretation of the model
In the dashboard above, we see the top predictors first. As the canton of Vaud is the one with the most data (250 rows), it is not surprising to see that these data have the most impact on the prediction. Indeed, the simple fact of living in the canton of Vaud improves the prediction by almost 2%. If the person is also subscribed to the newsletter the prediction is improved by nearly 5%. On the other hand, it is deteriorated by almost 3% if the person is not subscribed.
We do not see any top predictors about the other data, probably because they are relatively low to have enough impact on the prediction. Indeed, the more data we have, the more varied and precise the model's predictions will be.
Remember that the only actionable variable we have defined is whether to sign-up a person to the newsletter or not. Here we see that the prediction would be improved by more than 8% if everyone was subscribed to the newsletter.
What if analysis in Tableau using AI model from Einstein discovery
We can perform a What-if analysis directly in Tableau, based on our Einstein discovery model. For this, we will need to create parameters in Tableau, corresponding to the fields that are present in the AI model. For example, we create a parameter for the cantons of residence of the clients:
We do the same for all fields in the model, and to use the Einstein discovery extention with parameters in Tableau, we do not need the worksheet we created before.
After creating all the parameters, load the model in Tableau via the extension, and select “Parameters” instead of “Worksheet”.
Since we have named the parameters in the exact same way as the model fields, the mapping will be done automatically.
Now the prediction shown in Tableau is based on the values passed in parameter. This allows us to create a what-if analysis without having written a single line of code!
In the example below, we see the prediction for a 30 years old woman who lives in the canton of Jura. She is a prospect who arrived with the promotion and is not registered to the newsletter. Given this data, she is 43% likely to become a client.
We can directly see the impact of changing one of the parameters. By changing the newsletter parameter (i.e. registering her to the newsletter), the prediction of her becoming a client increases to 52%.
We hope that you enjoyed this article and are curious about Einstein discovery and Tableau. Please feel free to send us an email at email@example.com for further information.